174e586
#!/bin/sh
174e586
#
174e586
# Startup script for milter-regex
174e586
#
174e586
# chkconfig: - 75 40
174e586
# description: Allows sendmail to filter mail using regular expressions
174e586
# processname: milter-regex
174e586
# config: /etc/mail/milter-regex.conf /etc/sysconfig/milter-regex
174e586
b3ba585
### BEGIN INIT INFO
b3ba585
# Provides: milter-regex
b3ba585
# Required-Start: $local_fs $network $syslog $named
b3ba585
# Required-Stop: $local_fs $network $syslog $named
b3ba585
# Short-Description: Start or stop Regex Milter
b3ba585
# Description: Milter-regex allows regular expression based filtering of mail
b3ba585
#	messages as they arrive in sendmail
b3ba585
### END INIT INFO
b3ba585
174e586
# Source function library.
174e586
. /etc/rc.d/init.d/functions
174e586
174e586
# Source options file
174e586
[ -f /etc/sysconfig/milter-regex ] && . /etc/sysconfig/milter-regex
174e586
b3ba585
[ -x /usr/sbin/milter-regex ] || exit 5
174e586
174e586
prog="milter-regex"
174e586
174e586
start() {
174e586
    echo -n $"Starting $prog: " 
174e586
    daemon $prog $OPTIONS
174e586
    RETVAL=$? 
174e586
    echo
b3ba585
    if [ $RETVAL -eq 0 ]; then
b3ba585
        touch /var/lock/subsys/milter-regex
b3ba585
    else
b3ba585
        exit 7
b3ba585
    fi
b3ba585
    return 0
174e586
}
174e586
174e586
stop() {
174e586
    if test "x`pidof milter-regex`" != x; then
174e586
	echo -n $"Stopping $prog: "
174e586
	killproc milter-regex
174e586
	echo
174e586
    fi
174e586
    RETVAL=$?
174e586
    rm -f /var/lock/subsys/milter-regex
b3ba585
    if test "x`pidof milter-regex`" = x; then
b3ba585
        return 0
b3ba585
    else
b3ba585
        return 1
b3ba585
    fi
174e586
}
174e586
174e586
case "$1" in
174e586
	start)
174e586
	    start
174e586
	    ;;
174e586
	stop)
174e586
	    stop
174e586
	    ;;
174e586
	status)
174e586
	    status milter-regex
174e586
	    ;;
b3ba585
	reload)
b3ba585
	    # milter-regex reloads configuration automatically if the config
b3ba585
	    # file has changed, so the reload action is a no-op
b3ba585
	    exit 0
b3ba585
	    ;;
b3ba585
	force-reload|restart)
b3ba585
	    if test "x`pidof milter-regex`" != x; then
b3ba585
	        stop
b3ba585
	    fi
174e586
	    start
174e586
	    ;;
b3ba585
	condrestart|try-restart)
174e586
	    if test "x`pidof milter-regex`" != x; then
174e586
		stop
174e586
		start
174e586
	    fi
174e586
	    ;;
174e586
	*)
b3ba585
	    echo $"Usage: $0 {start|stop|force-reload|restart|try-restart|status}"
b3ba585
	    exit 2
174e586
esac