#!/bin/sh
#
# $Id: spamass-milter-redhat.rc,v 1.4 2003/03/06 21:33:51 dnelson Exp $
#
# spamass-milter This script starts and stops the spamass-milter daemon
#
# chkconfig: 2345 80 30
#
# description: spamass-milter is a daemon which hooks into sendmail and routes
#              email messages to spamassassin
# processname: spamass-milter


# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Local spamass-milter config
SM_SOCKET=/var/run/spamass.sock
SM_EXTRA_FLAGS=
[ -f /etc/sysconfig/spamass-milter ] && . /etc/sysconfig/spamass-milter

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -x /usr/sbin/spamass-milter ] || exit 0
PATH=$PATH:/usr/sbin

RETVAL=0

start() {
        echo -n "Starting spamass-milter: "
        daemon spamass-milter -p ${SM_SOCKET} -f ${SM_EXTRA_FLAGS}
        RETVAL=$?
        echo
	test $RETVAL -eq 0 && touch /var/lock/subsys/spamass-milter
	return $RETVAL
}

stop() {
        echo -n "Shutting down spamass-milter: "
        killproc spamass-milter
        RETVAL=$?
        echo
	test $RETVAL -eq 0 && rm -f /var/lock/subsys/spamass-milter
}

restart() {
	stop
	start
}

# See how we were called.
case "$1" in
  start)
        # Start daemon.
	start
        ;;
  stop)
        # Stop daemon.
	stop
        ;;
  restart|reload)
	restart
        ;;
  condrestart)
	test -f /var/lock/subsys/spamass-milter && $0 restart || :
        ;;
  status)
        status spamass-milter
        ;;
  *)
        echo "Usage: $0 {start|stop|reload|restart|condrestart|status}"
        exit 1
esac

exit $?


syntax highlighted by Code2HTML, v. 0.9.1