Skip to content

Instantly share code, notes, and snippets.

@lusentis
Created October 28, 2013 13:48
Show Gist options
  • Save lusentis/7197095 to your computer and use it in GitHub Desktop.
Save lusentis/7197095 to your computer and use it in GitHub Desktop.
#!/bin/bash
app=
port=
#cmd="~/.venv/bin/gunicorn_django -b 127.0.0.1:$port"
cmd="~/nodejs/bin/node app.js"
if [ ! -f ~/mon.pid ]
then
echo '0' > ~/mon.pid
echo '' >> ~/mon.log
else
echo 'Sending SIGTERM to existing processes...'
kill -TERM $(cat ~/mon.pid)
sleep 3
echo 'Sending SIGKILL to existing processes...'
kill -KILL $(cat ~/mon.pid)
fi
cd ~/$app
source ~/.env
mon --daemonize -l ~/mon.log -p ~/mon.pid "$cmd"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment