#! /bin/sh # amavis init script # February 26, 2006 # David Sims # Based on SpamAssassin script PATH=/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/sbin/amavisd NAME=amavisd SNAME=amavisd DESC="Amavis Mail Filter Daemon" PIDFILE="/var/run/$NAME.pid" PNAME="amavisd" export TMPDIR=/tmp # Apparently people have trouble if this isn't explicitly set... # Defaults - don't touch, edit /etc/default/amavisd ENABLED=0 OPTIONS="" NICE= test -f /etc/default/amavisd && . /etc/default/amavisd if [ "$ENABLED" = "0" ]; then echo "$DESC: disabled, see /etc/default/amavisd" exit 0 fi test -f $DAEMON || exit 0 set -e case "$1" in start) echo -n "Starting $DESC: " start-stop-daemon --start --pidfile $PIDFILE --name $PNAME \ $NICE --oknodo --startas $DAEMON -- $OPTIONS $DOPTIONS echo "$NAME." ;; stop) echo -n "Stopping $DESC: " start-stop-daemon --stop --pidfile $PIDFILE --name $PNAME --oknodo rm $PIDFILE echo "$NAME." ;; reload|force-reload) echo -n "Reloading $DESC: " start-stop-daemon --stop --pidfile $PIDFILE --signal HUP --name $PNAME echo "$NAME." ;; restart) echo -n "Restarting $DESC: " start-stop-daemon --stop --pidfile $PIDFILE --name $PNAME \ --retry 5 --oknodo start-stop-daemon --start --pidfile $PIDFILE --name $PNAME \ $NICE --oknodo --startas $DAEMON -- $OPTIONS $DOPTIONS echo "$NAME." ;; *) N=/etc/init.d/$SNAME echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 exit 1 ;; esac exit 0