]> git.pld-linux.org Git - packages/sendmail.git/blobdiff - sendmail.init
- use pidfiles to kill sendmail procs
[packages/sendmail.git] / sendmail.init
index 34127ced3ce41acd355e75167836ac34afc25914..20e3fa8dda296892706e19a2cd1e5bf3bef227b8 100644 (file)
@@ -23,6 +23,8 @@ else
        QUEUE=1h
        ENABLE_IPV6=yes
 fi
+[ -z "$SMQUEUE" ] && SMQUEUE="$QUEUE"
+[ -z "$SMQUEUE" ] && SMQUEUE=1h
 
 # Check that networking is up.
 if is_yes "${NETWORKING}"; then
@@ -60,28 +62,56 @@ case "$1" in
        else
                msg_already_running sendmail
        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)
        if [ -f /var/lock/subsys/sendmail ]; then
                # Stop daemons.
                msg_stopping sendmail
-               killproc sendmail
-               rm -f /var/lock/subsys/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|force-reload)
+  restart)
        $0 stop
        $0 start
        exit $?
        ;;
+  reload|force-reload)
+       # TODO: make it better for sm-client
+       if [ -f /var/lock/subsys/sendmail ]; then
+               msg_reloading sendmail
+               busy
+               killproc sendmail -HUP
+               RETVAL=$?
+       else
+               msg_not_running sendmail
+       fi
+       ;;
   status)
        status sendmail
        exit $?
        ;;
   *)
-       msg_usage "$0 {start|stop|restart|force-reload|status}"
+       msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
        exit 3
 esac
 
This page took 0.037915 seconds and 4 git commands to generate.