Skip to content

Instantly share code, notes, and snippets.

@cyrillsemenov
Created January 28, 2023 16:05
Show Gist options
  • Save cyrillsemenov/2b08603f253e2861b0ee8d80967326f1 to your computer and use it in GitHub Desktop.
Save cyrillsemenov/2b08603f253e2861b0ee8d80967326f1 to your computer and use it in GitHub Desktop.
.git/hooks/post-merge for stop and rerun application on push
#!/bin/sh
cd ~/<work_dir_here>
script=main.py
pid=$(ps auxwww | grep $script | grep -v grep | awk '{print $2}')
kill -9 $pid
pip install -r requirements.txt
nohup python -u $script > script.log 2>&1 &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment