debian/rules: Use `git' potty wrapper.
[qmail] / debian / qmail
1 #!/bin/sh
2 #
3 # /etc/init.d/qmail : start or stop the qmail mail subsystem.
4 #
5 # Written by Christian Hudon <chrish@debian.org>
6
7 #
8 # Configuration
9 #
10
11
12 # set default delivery method
13
14 alias_empty="|/usr/sbin/qmail-procmail" # procmail delivery to /var/spool/mail
15 #alias_empty="./Maildir/" # This uses qmail prefered ~/Maildir/ directory
16 #alias_empty="./Mailbox" # This uses Mailbox file in users $HOME
17
18 logger="splogger qmail"
19 #logger="|accustamp >>/var/log/qmail.log" # If you have accustamp installed.
20 #logger=">>/var/log/qmail.log" # Does not give timing info.
21
22 # If you uncommented one of the lines that appends to /var/log/qmail.log, you
23 # need to uncomment the following two lines.
24 #touch /var/log/qmail.log
25 #chown qmaill /var/log/qmail.log
26
27 #
28 # End of configuration
29 #
30
31 test -x /usr/sbin/qmail-start || exit 0
32 test -x /usr/sbin/qmail-send || exit 0
33
34 case "$1" in
35 start)
36 echo -n "Starting mail-transfer agent: qmail"
37 sh -c "start-stop-daemon --start --quiet \
38 --exec /usr/sbin/qmail-send \
39 --startas /usr/sbin/qmail-start -- \"$alias_empty\" $logger &"
40 echo "."
41 ;;
42 stop)
43 echo -n "Stopping mail-transfer agent: qmail"
44 if [ "`pidof /usr/sbin/qmail-send`" ] ; then
45 start-stop-daemon --stop --quiet --oknodo --exec /usr/sbin/qmail-send
46
47 # Wait until the timeout for qmail processes to die.
48 count=120
49 numdots=0
50 while ([ $count != 0 ]) do
51 let count=$count-1
52 if [ "`pidof /usr/sbin/qmail-send`" ] ; then
53 echo -n .
54 let numdots=$numdots+1
55 sleep 1
56 else
57 count=0
58 fi
59 done
60
61 # If it's not dead yet, kill it.
62 # if [ "`pidof /usr/sbin/qmail-send`" ] ; then
63 # echo -n " TIMEOUT!"
64 # kill -KILL `pidof /usr/sbin/qmail-send`
65 # else
66 case $numdots in
67 0) echo "." ;;
68 1) echo ;;
69 *) echo " done." ;;
70 esac
71 # fi
72 else
73 echo " not running.";
74 fi
75
76 ;;
77 restart)
78 $0 stop
79 $0 start
80 ;;
81 reload)
82 echo "Reloading 'locals' and 'virtualdomains' control files."
83 start-stop-daemon --stop --quiet --oknodo --signal HUP --exec /usr/sbin/qmail-send
84 ;;
85 *)
86 echo 'Usage: /etc/init.d/qmail {start|stop|restart|reload}'
87 exit 1
88 esac
89
90 exit 0