X-Git-Url: https://git.distorted.org.uk/~mdw/qmail/blobdiff_plain/2117e02ec495fdfd6e96b39778b701a5bcff8aa5..9312c29dd4ff4591809c01f71361d8cfe92db67c:/debian/qmail diff --git a/debian/qmail b/debian/qmail new file mode 100644 index 0000000..55e7faa --- /dev/null +++ b/debian/qmail @@ -0,0 +1,90 @@ +#!/bin/sh +# +# /etc/init.d/qmail : start or stop the qmail mail subsystem. +# +# Written by Christian Hudon + +# +# Configuration +# + + +# set default delivery method + +alias_empty="|/usr/sbin/qmail-procmail" # procmail delivery to /var/spool/mail +#alias_empty="./Maildir/" # This uses qmail prefered ~/Maildir/ directory +#alias_empty="./Mailbox" # This uses Mailbox file in users $HOME + +logger="splogger qmail" +#logger="|accustamp >>/var/log/qmail.log" # If you have accustamp installed. +#logger=">>/var/log/qmail.log" # Does not give timing info. + +# If you uncommented one of the lines that appends to /var/log/qmail.log, you +# need to uncomment the following two lines. +#touch /var/log/qmail.log +#chown qmaill /var/log/qmail.log + +# +# End of configuration +# + +test -x /usr/sbin/qmail-start || exit 0 +test -x /usr/sbin/qmail-send || exit 0 + +case "$1" in + start) + echo -n "Starting mail-transfer agent: qmail" + sh -c "start-stop-daemon --start --quiet \ + --exec /usr/sbin/qmail-send \ + --startas /usr/sbin/qmail-start -- \"$alias_empty\" $logger &" + echo "." + ;; + stop) + echo -n "Stopping mail-transfer agent: qmail" + if [ "`pidof /usr/sbin/qmail-send`" ] ; then + start-stop-daemon --stop --quiet --oknodo --exec /usr/sbin/qmail-send + + # Wait until the timeout for qmail processes to die. + count=120 + numdots=0 + while ([ $count != 0 ]) do + let count=$count-1 + if [ "`pidof /usr/sbin/qmail-send`" ] ; then + echo -n . + let numdots=$numdots+1 + sleep 1 + else + count=0 + fi + done + + # If it's not dead yet, kill it. +# if [ "`pidof /usr/sbin/qmail-send`" ] ; then +# echo -n " TIMEOUT!" +# kill -KILL `pidof /usr/sbin/qmail-send` +# else + case $numdots in + 0) echo "." ;; + 1) echo ;; + *) echo " done." ;; + esac +# fi + else + echo " not running."; + fi + + ;; + restart) + $0 stop + $0 start + ;; + reload) + echo "Reloading 'locals' and 'virtualdomains' control files." + start-stop-daemon --stop --quiet --oknodo --signal HUP --exec /usr/sbin/qmail-send + ;; + *) + echo 'Usage: /etc/init.d/qmail {start|stop|restart|reload}' + exit 1 +esac + +exit 0