Sophie

Sophie

distrib > Mandriva > 2009.0 > x86_64 > by-pkgid > bc7eb0d610af2b19a5488ce8ff07ced8 > files > 5

dspam-3.8.0-4mdv2009.0.src.rpm

#!/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)
	echo -n "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)
	echo -n "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=$?
	;;
  *)
	echo "Usage: dspam {start|stop|status|restart|condrestart|reload}"
	exit 1
esac

exit $RETVAL