#!/bin/sh
#
# Start or stop sendmail
#
# Robert Leslie <rob@mars.org>

test -x /usr/sbin/sendmail -a  \
     -f /etc/sendmail.cf || exit 0

# How often to run the queue
Q="30m"

case "$1" in
    start)
	( cd /var/spool/mqueue && rm -f [lnx]f* )
	start-stop-daemon --start --verbose --exec /usr/sbin/sendmail --  \
	    -bd -q"$Q"
    ;;

    stop)
	start-stop-daemon --stop --verbose  \
	    --pidfile /var/run/sendmail.pid --exec /usr/sbin/sendmail
    ;;

    reload)
	start-stop-daemon --stop --signal 1 --verbose  \
	    --pidfile /var/run/sendmail.pid --exec /usr/sbin/sendmail
    ;;

    *)
	echo "Usage: /etc/init.d/sendmail {start|stop|reload}" >&2
	exit 1
    ;;
esac

exit 0
