Blob Blame History Raw
#!/bin/sh
#
# Startup script for milter-regex
#
# chkconfig: - 75 40
# description: Allows sendmail to filter mail using regular expressions
# processname: milter-regex
# config: /etc/mail/milter-regex.conf /etc/sysconfig/milter-regex

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

# Source options file
[ -f /etc/sysconfig/milter-regex ] && . /etc/sysconfig/milter-regex

[ -f /usr/sbin/milter-regex ] || exit 0

prog="milter-regex"

start() {
    echo -n $"Starting $prog: " 
    daemon $prog $OPTIONS
    RETVAL=$? 
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/milter-regex
    echo
    return $RETVAL
}

stop() {
    if test "x`pidof milter-regex`" != x; then
	echo -n $"Stopping $prog: "
	killproc milter-regex
	echo
    fi
    RETVAL=$?
    rm -f /var/lock/subsys/milter-regex
    return $RETVAL
}

case "$1" in
	start)
	    start
	    ;;
	stop)
	    stop
	    ;;
	
	status)
	    status milter-regex
	    ;;
	restart)
	    stop
	    start
	    ;;
	condrestart|reload)
	    if test "x`pidof milter-regex`" != x; then
		stop
		start
	    fi
	    ;;
	
	*)
	    echo $"Usage: $0 {start|stop|restart|condrestart|reload|status}"
	    exit 1

esac

exit $RETVAL