#! /bin/sh
#
-# sendmail This shell script takes care of starting and stopping
-# sendmail.
+# 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 \
. /etc/sysconfig/sendmail
else
DAEMON=yes
- QUEUE=1h
+ QUEUE=1h
ENABLE_IPV6=yes
fi
# Check that networking is up.
-if is_no "${NETWORKING}"; then
- msg_Network_Down Sendmail
- exit 1
+if is_yes "${NETWORKING}"; then
+ if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+ msg_network_down Sendmail
+ exit 1
+ fi
+else
+ exit 0
fi
+RETVAL=0
# See how we were called.
case "$1" in
start)
busy
/usr/bin/newaliases >/dev/null 2>&1
for i in virtusertable access domaintable mailertable; do
- if [ -f /etc/mail/$i ] ; then
+ if [ -f /etc/mail/$i ]; then
makemap -v hash /etc/mail/$i < /etc/mail/$i >/dev/null 2>&1
+ [ $RETVAL -eq 0 ] && RETVAL=$?
fi
done
- deltext;ok
+ [ $RETVAL -eq 0 ] && ok || fail
msg_starting sendmail
- daemon /usr/sbin/sendmail $SENDMAIL_CF
daemon /usr/sbin/sendmail $([ "$DAEMON" = "yes" ] && echo -bd) \
$([ -n "$QUEUE" ] && echo -q$QUEUE) \
$([ "$ENABLE_IPV6" = "yes" ] &&
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/sendmail
else
- msg_Already_Running sendmail
- exit 1
+ msg_already_running sendmail
fi
;;
stop)
- # Stop daemons.
- msg_stopping sendmail
- killproc sendmail
- RETVAL=$?
- [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sendmail
+ if [ -f /var/lock/subsys/sendmail ]; then
+ # Stop daemons.
+ msg_stopping sendmail
+ killproc sendmail
+ rm -f /var/lock/subsys/sendmail
+ else
+ msg_not_running sendmail
+ fi
;;
- restart|reload)
+ restart|force-reload)
$0 stop
$0 start
- ;;
- condrestart)
- if [ -f /var/lock/subsys/sendmail ]; then
- stop
- start
- RETVAL=$?
- fi
+ exit $?
;;
status)
status sendmail
- RETVAL=$?
+ exit $?
;;
*)
- echo "Usage: sendmail {start|stop|restart|reload|condrestart|status}"
- exit 1
+ msg_usage "$0 {start|stop|restart|force-reload|status}"
+ exit 3
esac
exit $RETVAL