Created
April 12, 2013 13:23
-
-
Save FZambia/5371960 to your computer and use it in GitHub Desktop.
start-stop-daemon with tornado example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DAEMON_DIR=/opt/mytornadoapp | |
DAEMON=$DAEMON_DIR/main.py | |
NAME=tornado | |
DESC="tornado daemon" | |
test -f $DAEMON || exit 0 | |
set -e | |
case "$1" in | |
start) | |
echo -n "Starting $DESC: " | |
start-stop-daemon --start --pidfile /var/run/$NAME.pid \ | |
--chdir $DAEMON_DIR \ | |
--make-pidfile --background -c nobody --startas $DAEMON | |
echo "$NAME." | |
;; | |
stop) | |
echo -n "Stopping $DESC: " | |
start-stop-daemon --stop --quiet --oknodo \ | |
--pidfile /var/run/$NAME.pid | |
rm -f /var/run/$NAME.pid | |
echo "$NAME." | |
;; | |
restart) | |
echo -n "Restarting $DESC: " | |
start-stop-daemon --stop --quiet --oknodo \ | |
--pidfile /var/run/$NAME.pid | |
rm -f /var/run/$NAME.pid | |
start-stop-daemon --start --pidfile /var/run/$NAME.pid \ | |
--chdir $DAEMON_DIR \ | |
--make-pidfile --background -c nobody --startas $DAEMON | |
echo "$NAME." | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment