whitelister/debian/whitelister.init

74 lines
1.5 KiB
Bash

#! /bin/sh
### BEGIN INIT INFO
# Provides: whitelister
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# X-Start-Before: postfix
# X-Stop-After: postfix
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
#
# whitelister start/stop the whitelister deamon for postfix
# (priority should be smaller than that of postfix)
#
# Author: (c)2005 Pierre Habouzit <madcoder@debian.org>
# Based on Debian sarge's 'skeleton' example
# Distribute and/or modify at will.
#
# Version: $Id: whitelister.init,v 1.3 2005/05/20 13:13:14 x2000habouzit Exp $
#
set -e
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DESC="postfix whitelister daemon"
NAME=whitelister
DAEMON=/usr/sbin/$NAME
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
d_start() {
start-stop-daemon --start --quiet --pidfile $PIDFILE \
--exec $DAEMON || echo -n " (already running)"
}
d_stop() {
start-stop-daemon --stop --oknodo --quiet --pidfile $PIDFILE \
--name $NAME
rm -f $PIDFILE
}
d_restart() {
d_stop
sleep 1
d_start
}
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
d_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
d_stop
echo "."
;;
force-reload|restart)
echo -n "Restarting $DESC: $NAME"
d_restart
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0