#! /bin/sh # set -e PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DESC="spam filter" NAME=spambayes DAEMON=/usr/bin/sb_server.py SCRIPTNAME=/etc/init.d/spambayes # Gracefully exit if the package has been removed. test -x $DAEMON || exit 0 . /etc/default/$NAME # # Function that starts the daemon/service. # d_start() { cd $DBDIR && su $RUNAS sb_server.py > /dev/null 2>&1 & } # # Function that stops the daemon/service. # d_stop() { killall sb_server.py > /dev/null 2>&1 || true } case "$1" in start) echo -n "Starting $DESC: $NAME" d_start echo "." ;; stop) echo -n "Stopping $DESC: $NAME" d_stop echo "." ;; restart|force-reload) echo -n "Restarting $DESC: $NAME" d_stop sleep 1 d_start echo "." ;; *) echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit 0