#!/bin/sh # # dspam: Starts DSPAM in daemon mode # # Written by Stevan Bajic <stevan@bajic.ch>. # # chkconfig: - 40 80 # description: DSPAM (De-Spam) is a scalable, open-source statistical # anti-spam filter that provides high levels of accuracy with minimal # resources. # processname: dspam # pidfile: /var/run/dspam/dspam.pid # Source function library. . /etc/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Source config if [ -f /etc/sysconfig/dspam ] ; then . /etc/sysconfig/dspam else DSPAM_BIN="/usr/bin/dspam" DSPAM_USER="dspam" fi # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 RETVAL=0 prog="dspam" start() { echo -n $"Starting $prog: " if [ -f /var/lock/subsys/dspam ]; then RETVAL=0 else daemon --check ${DSPAM_BIN} --user ${DSPAM_USER} ${DSPAM_BIN} --daemon 2>/dev/null& sleep 1 status ${prog} &> /dev/null && echo_success || echo_failure fi echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dspam return $RETVAL } stop() { echo -n $"Stopping $prog: " killproc dspam RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dspam return $RETVAL } reload() { echo -n $"Reloading $prog configuration: " killproc dspam -HUP RETVAL=$? echo return $RETVAL } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status $prog ;; reload) reload ;; restart) stop start ;; condrestart) [ -f /var/lock/subsys/dspam ] && stop && start || : ;; *) echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}" ;; esac exit $RETVAL