]>
Commit | Line | Data |
---|---|---|
a0c812d1 | 1 | #!/bin/sh |
2 | # IMAP Auth Daemon | |
3 | # | |
4 | # chkconfig: 345 80 20 | |
5 | # description: IMAP Auth Daemon | |
6 | ||
7 | # Source function library | |
8 | . /etc/rc.d/init.d/functions | |
9 | ||
10 | # Get network config | |
11 | . /etc/sysconfig/network | |
12 | ||
13 | METHOD="plain" | |
14 | ||
15 | [ -f /etc/sysconfig/authdaemon ] && . /etc/sysconfig/authdaemon | |
16 | ||
17 | # Check that networking is up. | |
0838e112 | 18 | if is_yes "${NETWORKING}"; then |
ac84c9b5 | 19 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then |
0838e112 | 20 | msg_network_down "Courier IMAP - Authdaemon" |
21 | exit 1 | |
22 | fi | |
23 | else | |
24 | exit 0 | |
a0c812d1 | 25 | fi |
26 | ||
d5f9e77f | 27 | RETVAL=0 |
a0c812d1 | 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/authdaemon ]; then | |
33 | msg_starting "Courier IMAP - Authdaemon" | |
34 | daemon /usr/lib/courier-imap/authlib/authdaemond.$METHOD start | |
0838e112 | 35 | RETVAL=$? |
36 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/authdaemon | |
a0c812d1 | 37 | else |
7ea5697f | 38 | msg_already_running "Courier IMAP - Authdaemon" |
a0c812d1 | 39 | fi |
40 | ;; | |
41 | stop) | |
42 | if [ -f /var/lock/subsys/authdaemon ]; then | |
43 | msg_stopping "Courier IMAP - Authdaemon" | |
44 | daemon /usr/lib/courier-imap/authlib/authdaemond.$METHOD stop | |
a0c812d1 | 45 | rm -f /var/lock/subsys/authdaemon |
46 | else | |
47 | msg_not_running "Courier IMAP - Authdaemon" | |
a0c812d1 | 48 | fi |
49 | ;; | |
d5f9e77f | 50 | restart|force-reload) |
e781919f | 51 | # restart related services, if running.. |
52 | if [ -f /var/lock/subsys/courier-mta -a \ | |
0838e112 | 53 | -x /etc/rc.d/init.d/courier-mta ]; then |
54 | /etc/rc.d/init.d/courier-mta stop | |
55 | crun=1 | |
e781919f | 56 | fi |
57 | if [ -f /var/lock/subsys/courier-imap -a \ | |
0838e112 | 58 | -x /etc/rc.d/init.d/courier-imap ]; then |
59 | /etc/rc.d/init.d/courier-imap stop | |
60 | imaprun=1 | |
e781919f | 61 | fi |
0e7557ae | 62 | if [ -f /var/lock/subsys/courier-pop3 -a \ |
0838e112 | 63 | -x /etc/rc.d/init.d/courier-pop3 ]; then |
64 | /etc/rc.d/init.d/courier-pop3 stop | |
65 | poprun=1 | |
e781919f | 66 | fi |
a0c812d1 | 67 | $0 stop |
68 | $0 start | |
fba02342 | 69 | RETVAL=$? |
f4a2230e AM |
70 | [ "$imaprun" -eq 1 ] && /etc/rc.d/init.d/courier-imap start |
71 | [ "$poprun" -eq 1 ] && /etc/rc.d/init.d/courier-pop3 start | |
72 | [ "$crun" -eq 1 ] && /etc/rc.d/init.d/courier-mta start | |
e781919f | 73 | unset crun |
74 | unset poprun | |
75 | unset imaprun | |
a0c812d1 | 76 | ;; |
77 | status) | |
78 | status authdaemond.$METHOD | |
d5f9e77f | 79 | exit $? |
a0c812d1 | 80 | ;; |
81 | *) | |
d5f9e77f | 82 | msg_usage "$0 {start|stop|restart|force-reload|status}" |
83 | exit 3 | |
f4a2230e | 84 | ;; |
a0c812d1 | 85 | esac |
86 | ||
87 | exit $RETVAL |