Postfix/INIT Script

# # # . /etc/rc.d/init.d/functions . /etc/sysconfig/network RETVAL=0 prog="postfix" status master >/dev/null 2>&1 running=$? conf_check { [ -x /usr/sbin/postfix ] || exit 5 [ -d /etc/postfix ] || exit 6 [ -d /var/spool/postfix ] || exit 5 } start { # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 1 conf_check # Start daemons. echo -n $"Starting postfix: " /usr/bin/newaliases >/dev/null 2>&1 /usr/sbin/postfix start 2>/dev/null 1>&2 && success || failure $"$prog start" RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/postfix echo return $RETVAL } stop { conf_check # Stop daemons. echo -n $"Shutting down postfix: " /usr/sbin/postfix stop 2>/dev/null 1>&2 && success || failure $"$prog stop" RETVAL=$? [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/postfix echo return $RETVAL } reload { conf_check echo -n $"Reloading postfix: " /usr/sbin/postfix reload 2>/dev/null 1>&2 && success || failure $"$prog reload" RETVAL=$? echo return $RETVAL } abort { conf_check /usr/sbin/postfix abort 2>/dev/null 1>&2 && success || failure $"$prog abort" return $? } flush { conf_check /usr/sbin/postfix flush 2>/dev/null 1>&2 && success || failure $"$prog flush" return $? } check { conf_check /usr/sbin/postfix check 2>/dev/null 1>&2 && success || failure $"$prog check" return $? } case "$1" in  start)         [ $running -eq 0 ] && exit 0         start         ;;   stop) [ $running -eq 0 ] || exit 0 stop ;;  restart|force-reload)         stop         start         ;;   reload) [ $running -eq 0 ] || exit 7 reload ;;  abort)         abort         ;;   flush) flush ;;  check)         check         ;;   status) status master ;;  condrestart)         [ $running -eq 0 ] || exit 0         stop         start         ;;   *) echo $"Usage: $0 {start|stop|restart|reload|abort|flush|check|status|condrestart}" exit 2 esac exit $?
 * 1) !/bin/bash
 * 1) postfix      Postfix Mail Transfer Agent
 * 1) chkconfig: - 80 30
 * 2) description: Postfix is a Mail Transport Agent, which is the program \
 * 3)              that moves mail from one machine to another.
 * 4) processname: master
 * 5) pidfile: /var/spool/postfix/pid/master.pid
 * 6) config: /etc/postfix/main.cf
 * 7) config: /etc/postfix/master.cf
 * 1) Based on startup script from Simon J Mudd 
 * 1) BEGIN INIT INFO
 * 2) Provides: postfix MTA
 * 3) Required-Start: $local_fs $network $remote_fs
 * 4) Required-Stop: $local_fs $network $remote_fs
 * 5) Short-Description: start and stop postfix
 * 6) Description: Postfix is a Mail Transport Agent, which is the program that
 * 7)              moves mail from one machine to another.
 * 8) END INIT INFO
 * 1) Source function library.
 * 1) Source networking configuration.
 * 1) See how we were called.