#!/bin/bash # # dspam This shell script takes care of starting and stopping the dspam daemon. # # chkconfig: - 81 29 # description: dspam is a libary and MDA for Bayesian spam filtering. # processname: dspam # pidfile: /var/run/dspam/dspam.pid # config: /etc/dspam.conf # config: /etc/sysconfig/dspam # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 0 [ -f /etc/dspam.conf ] || exit 0 [ -f /etc/sysconfig/dspam ] && . /etc/sysconfig/dspam # grep config options DSPAM_PIDFILE=`grep '^ServerPID' /etc/dspam.conf|awk '{ print $2}'` DSPAM_SOCKET=`grep '^ServerDomainSocketPath' /etc/dspam.conf|awk '{ print $2}'` RETVAL=0 # See how we were called. case "$1" in start) gprintf "Starting dspam: " dspam --daemon ${DSPAM_USER:-""} ${DSPAM_DEBUG:-""} 2>/dev/null >/dev/null & success || failure RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dspam ;; stop) gprintf "Stopping dspam: " killproc dspam RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dspam ${DSPAM_PIDFILE} ${DSPAM_SOCKET} ;; status) status dspam RETVAL=$? ;; restart|reload) $0 stop $0 start RETVAL=$? ;; condrestart) [ -f /var/lock/subsys/dspam ] && restart RETVAL=$? ;; *) gprintf "Usage: dspam {start|stop|status|restart|condrestart|reload}\n" exit 1 esac exit $RETVAL