Skip to content

Instantly share code, notes, and snippets.

@davesque
Created January 7, 2013 18:34
Show Gist options
  • Select an option

  • Save davesque/4477309 to your computer and use it in GitHub Desktop.

Select an option

Save davesque/4477309 to your computer and use it in GitHub Desktop.
Daemonize uwsgi
#!/bin/bash
#/etc/init.d/uwsgi
daemon=/usr/local/bin/uwsgi
pid=/var/run/uwsgi.pid
args="--master --emperor /etc/vassals/ --uid www-data --daemonize /var/log/uwsgi/uwsgi.log"
case "$1" in
start)
echo "Starting uwsgi"
start-stop-daemon -p $pid --start --exec $daemon -- $args
;;
stop)
echo "Stopping script uwsgi"
start-stop-daemon --signal INT -p $pid --stop $daemon -- $args
;;
reload)
echo "Reloading conf"
touch /etc/vassals/*
;;
*)
echo "Usage: /etc/init.d/uwsgi {start|stop|reload}"
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment