contrib/spamassassin/spamassassin.rc
2010-03-26 04:16:20 +01:00

51 lines
1.5 KiB
Bash

#!/bin/sh
######################################################################
# spamassassin: This script starts and stops the spamd daemon
# description: spamd is a daemon process which uses SpamAssassin
# to check email messages for SPAM. It is normally
# called by spamc from a MDA.
######################################################################
daemon="/usr/bin/spamd"
options="-d -c -m5 -H"
######################################################################
# Start/Stop/Reload/Status Functions
######################################################################
start() {
$daemon $options
return $?
}
stop() {
pkill -x ${daemon##*/}
return $?
}
reload() {
pkill -HUP -x ${daemon##*/}
return $?
}
status() {
base=${daemon##*/}
dpid=`pidof -o $$ -o $PPID -o %PPID -x ${base}`
if [ "$dpid" != "" ]; then
echo "${base} (pid $dpid) is running..."
elif [ -s /var/run/${base}.pid ]; then
echo "${base} is dead but pid file exists..."
else
echo "${base} is stopped."
fi
return
}
######################################################################
# See how we were called
######################################################################
case "$1" in
start) start ;;
stop) stop ;;
reload) reload ;;
restart) stop;start ;;
status) status ;;
*) echo "Usage: $0 {start|stop|reload|restart|status}" ; exit 1
esac
exit $?