#!/bin/sh
########################################################################
# Begin sendmail
#
# Description : Starts Sendmail Mail Trasfer Agent
#
# Author      : Bruce Dubbs - bdubbs@linuxfromscratch.org
# Contributor : Jean-Marc Pigeon jmp@safe.ca
#
# Version     : LFS 8.3
#
########################################################################

### BEGIN INIT INFO
# Provides:            sendmail
# Required-Start:      $syslog $local_fs $network
# Should-Start:        $remote_fs openldap mysql postgresql saslauthd
# Required-Stop:       $network
# Should-Stop:         $remote_fs openldap mysql postgresql saslauthd
# Default-Start:       3 4 5
# Default-Stop:        0 1 2 6
# Short-Description:   Sendmail MTA
# Description:         Controls the Sendmail Mail Transfer Agent
### END INIT INFO

. /lib/lsb/init-functions

prog="/usr/sbin/sendmail"
progopt="-bs -bd -q5m"

case "$1" in
	start)
		log_info_msg "Starting sendmail..."
		start_daemon $prog $progopt start
      		evaluate_retval
		;;

	stop)
		log_info_msg "Stopping Sendmail..."
		killproc $prog
      		evaluate_retval
		;;

	status)
		statusproc $prog
		;;

	restart)
		$0 stop
		sleep 1
		$0 start
		;;

	condrestart)
		pid=`pidof $prog`
		if [ -n "${pid}"  -a -d /proc/$pid ]; then
		  $0 restart
		  fi
		;;

	*)
		echo "Usage: $0 {start|stop|status|restart|condrestart}"
		exit 1
		;;
esac

# End /etc/init.d/sendmail
