3 # sendmail This shell script takes care of starting and stopping
6 # chkconfig: 2345 80 30
7 # description: Sendmail is a Mail Transport Agent, which is the program \
8 # that moves mail from one machine to another.
9 # pidfile: /var/run/sendmail.pid
12 # Source function library
13 . /etc/rc.d/init.d/functions
16 . /etc/sysconfig/network
19 if [ -f /etc/sysconfig/sendmail ]; then
20 . /etc/sysconfig/sendmail
27 # Check that networking is up.
28 if is_yes "${NETWORKING}"; then
29 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
30 msg_network_down Sendmail
38 # See how we were called.
41 # Check if the service is already running?
42 if [ ! -f /var/lock/subsys/sendmail ]; then
43 show "Prepare sendmail db"
45 /usr/bin/newaliases >/dev/null 2>&1
46 for i in virtusertable access domaintable mailertable; do
47 if [ -f /etc/mail/$i ]; then
48 makemap -v hash /etc/mail/$i < /etc/mail/$i >/dev/null 2>&1
49 [ $RETVAL -eq 0 ] && RETVAL=$?
52 [ $RETVAL -eq 0 ] && ok || fail
54 daemon /usr/sbin/sendmail $([ "$DAEMON" = "yes" ] && echo -bd) \
55 $([ -n "$QUEUE" ] && echo -q$QUEUE) \
56 $([ "$ENABLE_IPV6" = "yes" ] &&
57 echo -ODaemonPortOptions=Family=inet6 )
59 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sendmail
61 msg_already_running sendmail
65 if [ -f /var/lock/subsys/sendmail ]; then
69 rm -f /var/lock/subsys/sendmail
71 msg_not_running sendmail
84 msg_usage "$0 {start|stop|restart|force-reload|status}"