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
299cb3b
### BEGIN INIT INFO
299cb3b
# Provides: milter-regex
299cb3b
# Required-Start: $local_fs $network $syslog $named
299cb3b
# Required-Stop: $local_fs $network $syslog $named
299cb3b
# Short-Description: Start or stop Regex Milter
299cb3b
# Description: Milter-regex allows regular expression based filtering of mail
299cb3b
#	messages as they arrive in sendmail
299cb3b
### END INIT INFO
299cb3b
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
299cb3b
[ -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
299cb3b
    if [ $RETVAL -eq 0 ]; then
299cb3b
        touch /var/lock/subsys/milter-regex
299cb3b
    else
299cb3b
        exit 7
299cb3b
    fi
299cb3b
    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
299cb3b
    if test "x`pidof milter-regex`" = x; then
299cb3b
        return 0
299cb3b
    else
299cb3b
        return 1
299cb3b
    fi
174e586
}
174e586
174e586
case "$1" in
174e586
	start)
174e586
	    start
174e586
	    ;;
174e586
	stop)
174e586
	    stop
174e586
	    ;;
174e586
	status)
174e586
	    status milter-regex
174e586
	    ;;
299cb3b
	reload)
299cb3b
	    # milter-regex reloads configuration automatically if the config
299cb3b
	    # file has changed, so the reload action is a no-op
299cb3b
	    exit 0
299cb3b
	    ;;
299cb3b
	force-reload|restart)
299cb3b
	    if test "x`pidof milter-regex`" != x; then
299cb3b
	        stop
299cb3b
	    fi
174e586
	    start
174e586
	    ;;
299cb3b
	condrestart|try-restart)
174e586
	    if test "x`pidof milter-regex`" != x; then
174e586
		stop
174e586
		start
174e586
	    fi
174e586
	    ;;
174e586
	*)
299cb3b
	    echo $"Usage: $0 {start|stop|force-reload|restart|try-restart|status}"
299cb3b
	    exit 2
174e586
esac