Import Debian changes 4.89-2+deb9u3~bpo8+1
[hcoop/debian/exim4.git] / debian / exim4-base.exim4.init
index 67a1059..8bc24e3 100644 (file)
@@ -4,7 +4,7 @@
 # Written by Miquel van Smoorenburg <miquels@drinkel.ow.org>.
 # Modified for Debian GNU/Linux by Ian Murdock <imurdock@gnu.ai.mit.edu>.
 # Modified for exim by Tim Cutts <timc@chiark.greenend.org.uk>
-# Modified for exim4 by Andreas Metzler <ametzler@downhill.at.eu.org>
+# Modified for exim4 by Andreas Metzler <ametzler@debian.org>
 #                   and Marc Haber <mh+debian-packages@zugschlus.de>
 
 ### BEGIN INIT INFO
@@ -37,9 +37,9 @@ export LANG
 QUEUERUNNER='combined'
 QUEUEINTERVAL='30m'
 UPEX4OPTS=''
-PIDFILE="/var/run/exim4/exim.pid"
-QRPIDFILE="/var/run/exim4/eximqr.pid"
 [ -f /etc/default/exim4 ] && . /etc/default/exim4
+PIDFILE="/run/exim4/exim.pid"
+QRPIDFILE="/run/exim4/eximqr.pid"
 
 upex4conf() {
   UPEX4CONF="update-exim4.conf"
@@ -48,7 +48,7 @@ upex4conf() {
   for p in $PATH; do
     if [ -x "$p/$UPEX4CONF" ]; then
       IFS="$OLDIFS"
-      $p/$UPEX4CONF $UPEX4OPTS
+      $p/$UPEX4CONF $UPEX4OPTS $1
       return 0
     fi
   done
@@ -81,8 +81,8 @@ log()
 
 start_exim()
 {
-  [ -e /var/run/exim4 ] || \
-    install -d -oDebian-exim -gDebian-exim -m750 /var/run/exim4
+  [ -e /run/exim4 ] || \
+    install -d -oDebian-exim -gDebian-exim -m750 /run/exim4
   case ${QUEUERUNNER} in
     combined)
       start_daemon -p "$PIDFILE" \
@@ -106,8 +106,8 @@ start_exim()
       log_progress_msg "exim4_queuerunner"
       ;;
     queueonly)
-      start_daemon -p "$QRPIDFILE" \
-        "$DAEMON" -oP $QRPIDFILE \
+      start_daemon -p "$PIDFILE" \
+        "$DAEMON" -oP $PIDFILE \
         "-q${QFLAGS}${QUEUEINTERVAL}" \
         ${COMMONOPTIONS} \
         ${QUEUERUNNEROPTIONS}
@@ -146,7 +146,7 @@ stop_exim()
 reload_exim()
 {
   case ${QUEUERUNNER} in
-    combined|no|ppp)
+    combined|no|ppp|queueonly)
       killproc -p "$PIDFILE" "$DAEMON" -HUP
       log_progress_msg "exim4"
       ;;
@@ -176,6 +176,8 @@ status()
   QRNAME="separate queue runner daemon"
   if [ "${QUEUERUNNER}" = "combined" ]; then
       SMTPNAME="combined SMTP listener and queue runner daemon"
+  elif [ "${QUEUERUNNER}" = "queueonly" ]; then
+    SMTPNAME="separate queue runner daemon"
   fi
   log_action_begin_msg "checking $QRNAME"
   if pidofproc -p "$QRPIDFILE" "$DAEMON" >/dev/null; then
@@ -238,11 +240,13 @@ case "$1" in
     warn_paniclog
     ;;
   restart)
+    # check whether newly generated config would work
+    upex4conf --check
     log_daemon_msg "Stopping MTA for restart"
+    stop_exim
     # regenerate exim4.conf
     upex4conf
     isconfigvalid
-    stop_exim
     log_end_msg 0
     sleep 2
     log_daemon_msg "Restarting MTA"
@@ -266,7 +270,7 @@ case "$1" in
     kill_all_exims $2
     ;;
   *)
-    echo "Usage: $0 {start|stop|restart|reload|status|what|force-stop}"
+    echo "Usage: $0 {start|stop|restart|reload|status|force-stop}"
     exit 1
     ;;
 esac