]>
Commit | Line | Data |
---|---|---|
70023ff1 | 1 | #!/bin/sh |
cae70075 AM |
2 | # |
3 | # eximqd Start/Stop eximq supervisor | |
4 | # | |
5 | # chkconfig: 345 81 29 | |
6 | # description: eximq - exim queue runners supervisor | |
7 | # | |
8 | # processname: eximq | |
9 | ||
10 | # Source function library | |
11 | . /etc/rc.d/init.d/functions | |
12 | ||
13 | # Get network config | |
14 | . /etc/sysconfig/network | |
15 | ||
16 | EXIMQ_CONFIG=/etc/mail/eximq.args | |
17 | ||
18 | # Get service config | |
19 | [ -f /etc/sysconfig/exim ] && . /etc/sysconfig/exim | |
20 | [ -f /etc/sysconfig/eximq ] && . /etc/sysconfig/eximq | |
21 | ||
22 | if [ -n "$QUEUE" ]; then | |
23 | echo "eximq requires QUEUE in /etc/sysconfig/exim to be empty" >&2 | |
24 | exit 1 | |
25 | fi | |
26 | ||
27 | RETVAL=0 | |
28 | # See how we were called. | |
29 | case "$1" in | |
30 | start) | |
31 | # Check if the service is already running? | |
32 | if [ ! -f /var/lock/subsys/eximq ]; then | |
33 | n=0 | |
34 | grep -v -e '^[[:space:]]*$' -e '^#' $EXIMQ_CONFIG | while read args; do | |
35 | n=$(printf '%02d' $(($n+1))) | |
36 | msg_starting "eximq $n daemon" | |
542e7d82 | 37 | daemon --user exim /usr/sbin/eximq.pl --pidfile /var/run/eximq/eximq.$n.pid --daemon $args |
cae70075 AM |
38 | RETVAL=$? |
39 | done | |
40 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/eximq | |
41 | else | |
42 | msg_already_running eximq | |
43 | fi | |
44 | ;; | |
45 | stop) | |
46 | # Stop daemons. | |
47 | if [ -f /var/lock/subsys/eximq ]; then | |
48 | n=0 | |
49 | grep -v -e '^[[:space:]]*$' -e '^#' $EXIMQ_CONFIG | while read args; do | |
50 | n=$(printf '%02d' $(($n+1))) | |
51 | msg_stopping "eximq $n daemon" | |
542e7d82 | 52 | killproc --pidfile /var/run/eximq/eximq.$n.pid eximq.pl |
cae70075 AM |
53 | done |
54 | rm -f /var/lock/subsys/eximq >/dev/null 2>&1 | |
55 | else | |
56 | msg_not_running eximq | |
57 | fi | |
58 | ;; | |
59 | restart) | |
60 | $0 stop | |
61 | $0 start | |
62 | exit $? | |
63 | ;; | |
64 | status) | |
65 | status eximq.pl | |
66 | exit $? | |
67 | ;; | |
68 | *) | |
69 | msg_usage "$0 {start|stop|restart|status}" | |
70 | exit 3 | |
71 | esac | |
72 | ||
73 | exit $RETVAL |