#! /bin/sh # example python daemon starter script # based on skeleton from Debian GNU/Linux # cliechti@gmx.net # place the daemon scripts in a folder accessible by root. /usr/local/sbin is a good idea #PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin #DAEMON=/usr/local/sbin/skyd.py NAME="skyd" DAEMON=$PYTHONPATH/$NAME.py DESC="SMEI SKYD daemon" PIDFILE="$SKYD/run/$NAME""_$(echo $HOSTNAME | gawk -F. '{print $1}').pid" test -f $DAEMON || exit 0 set -e case "$1" in start) echo -n "Starting $DESC" start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON echo ;; stop) echo -n "Stopping $DESC" start-stop-daemon --stop --quiet --pidfile $PIDFILE echo ;; reload) echo "Reloading $DESC configuration files" start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE echo ;; coast) echo "Coasting $DESC" start-stop-daemon --stop --signal 2 --quiet --pidfile $PIDFILE echo ;; restart) echo -n "Restarting $DESC" start-stop-daemon --stop --quiet --pidfile $PIDFILE sleep 1 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON echo ;; *) echo "Usage: $0 {start|stop|restart|reload|coast}" >&2 exit 1 ;; esac exit 0