X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=sendmail.init;h=874cc81db8524679b0026f3f841d6c347702051a;hb=8085d6aeda5b687df29e7af75060ac012398a15e;hp=613ecd2e108d92fc37874cf942bd6e0b6dc77716;hpb=e905adcf830052d835a07cce2b35277a7eadb9c2;p=packages%2Fsendmail.git diff --git a/sendmail.init b/sendmail.init index 613ecd2..874cc81 100644 --- a/sendmail.init +++ b/sendmail.init @@ -1,7 +1,7 @@ #! /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 \ @@ -20,16 +20,23 @@ if [ -f /etc/sysconfig/sendmail ]; then . /etc/sysconfig/sendmail else DAEMON=yes - QUEUE=1h + QUEUE=1h ENABLE_IPV6=yes fi +[ -z "$SMQUEUE" ] && SMQUEUE="$QUEUE" +[ -z "$SMQUEUE" ] && SMQUEUE=1h # 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) @@ -39,48 +46,73 @@ case "$1" in 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 + done + [ $RETVAL -eq 0 ] && ok || fail msg_starting sendmail daemon /usr/sbin/sendmail $([ "$DAEMON" = "yes" ] && echo -bd) \ $([ -n "$QUEUE" ] && echo -q$QUEUE) \ - $([ "$ENABLE_IPV6" = "yes" ] && + $([ "$ENABLE_IPV6" = "yes" ] && echo -ODaemonPortOptions=Family=inet6 ) RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sendmail else msg_already_running sendmail - exit 1 + fi + if [ ! -f /var/lock/subsys/sm-client ]; then + msg_starting sm-client + daemon /usr/sbin/sendmail -L sm-msp-queue -Ac -q$SMQUEUE + RETVAL=$? + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sm-client + else + msg_already_running sm-client 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 --pidfile sendmail.pid sendmail + RETVAL=$? + [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sendmail + else + msg_not_running sendmail + fi + if [ -f /var/lock/subsys/sm-client ]; then + msg_stopping sm-client + killproc --pidfile /var/spool/clientmqueue/sm-client.pid sendmail + RETVAL=$? + [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sm-client + else + msg_not_running sm-client + fi ;; - restart|reload) + restart) $0 stop $0 start + exit $? ;; - condrestart) + reload|force-reload) + # TODO: make it better for sm-client if [ -f /var/lock/subsys/sendmail ]; then - stop - start - RETVAL=$? + msg_reloading sendmail + busy + killproc sendmail -HUP + RETVAL=$? + else + msg_not_running sendmail fi - ;; + ;; status) status sendmail - RETVAL=$? + exit $? ;; *) - echo "Usage: sendmail {start|stop|restart|reload|condrestart|status}" - exit 1 + msg_usage "$0 {start|stop|restart|reload|force-reload|status}" + exit 3 esac exit $RETVAL