Skip to content

Instantly share code, notes, and snippets.

@alexlovelltroy
Created July 18, 2012 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexlovelltroy/3139093 to your computer and use it in GitHub Desktop.
Save alexlovelltroy/3139093 to your computer and use it in GitHub Desktop.
Django fcgi runner script
#!/bin/bash
function start {
./manage.py runfcgi host=127.0.0.1 port=8080
}
function stop {
PIDS=`ps aux |grep manage.py | grep -v grep|awk '{print $2}'`
kill $PIDS
}
function usage {
echo "usage: $0 [start|stop|restart|status]"
}
function status {
PIDS=`ps aux |grep manage.py | grep -v grep|awk '{print $2}'`
WORKERS=`echo $PIDS | wc -w`
echo "$WORKERS workers"
echo "$PIDS"
}
case "$1" in
"start") start; status;;
"stop") stop; status;;
"restart") stop; start; status;;
"status") status;;
*) usage;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment