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