#! /bin/sh # # sendmail This shell script takes care of starting and stopping # sendmail. # # chkconfig: 2345 80 30 # description: Sendmail is a Mail Transport Agent, which is the program \ # that moves mail from one machine to another. # pidfile: /var/run/sendmail.pid # Source function library . /etc/rc.d/init.d/functions # Get network config . /etc/sysconfig/network # Get service config [ -f /etc/sysconfig/sendmail ] && . /etc/sysconfig/sendmail # Check that networking is up. if is_no "${NETWORKING}"; then msg_Network_Down Sendmail exit 1 fi # See how we were called. case "$1" in start) # Check if the service is already running? if [ ! -f /var/lock/subsys/sendmail ]; then show "Prepare sendmail db" busy newaliases >/dev/null 2>&1 for i in virtusertable access domaintable mailertable; do if [ -f /etc/mail/$i ] ; then makemap -v hash /etc/mail/$i < /etc/mail/$i >/dev/null 2>&1 fi done deltext;ok msg_starting sendmail daemon /usr/sbin/sendmail $SENDMAIL_CF else msg_Already_Running sendmail exit 1 fi touch /var/lock/subsys/sendmail ;; stop) # Stop daemons. msg_stopping sendmail killproc sendmail rm -f /var/lock/subsys/sendmail ;; restart|reload) $0 stop $0 start ;; status) status sendmail ;; *) msg_Usage "$0 {start|stop|staus|restart|reload}" exit 1 esac exit 0