]>
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 |
19 | if [ ! -f /var/lock/subsys/network ]; then | |
20 | msg_network_down "Courier IMAP - Authdaemon" | |
21 | exit 1 | |
22 | fi | |
23 | else | |
24 | exit 0 | |
a0c812d1 | 25 | fi |
26 | ||
27 | # See how we were called. | |
28 | case "$1" in | |
29 | start) | |
30 | # Check if the service is already running? | |
31 | if [ ! -f /var/lock/subsys/authdaemon ]; then | |
32 | msg_starting "Courier IMAP - Authdaemon" | |
33 | daemon /usr/lib/courier-imap/authlib/authdaemond.$METHOD start | |
0838e112 | 34 | RETVAL=$? |
35 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/authdaemon | |
a0c812d1 | 36 | else |
7ea5697f | 37 | msg_already_running "Courier IMAP - Authdaemon" |
a0c812d1 | 38 | exit 1 |
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 | |
45 | RETVAL=$? | |
46 | rm -f /var/lock/subsys/authdaemon | |
47 | else | |
48 | msg_not_running "Courier IMAP - Authdaemon" | |
49 | exit 1 | |
50 | fi | |
51 | ;; | |
52 | restart|reload) | |
e781919f | 53 | # restart related services, if running.. |
54 | if [ -f /var/lock/subsys/courier-mta -a \ | |
0838e112 | 55 | -x /etc/rc.d/init.d/courier-mta ]; then |
56 | /etc/rc.d/init.d/courier-mta stop | |
57 | crun=1 | |
e781919f | 58 | fi |
59 | if [ -f /var/lock/subsys/courier-imap -a \ | |
0838e112 | 60 | -x /etc/rc.d/init.d/courier-imap ]; then |
61 | /etc/rc.d/init.d/courier-imap stop | |
62 | imaprun=1 | |
e781919f | 63 | fi |
0e7557ae | 64 | if [ -f /var/lock/subsys/courier-pop3 -a \ |
0838e112 | 65 | -x /etc/rc.d/init.d/courier-pop3 ]; then |
66 | /etc/rc.d/init.d/courier-pop3 stop | |
67 | poprun=1 | |
e781919f | 68 | fi |
a0c812d1 | 69 | $0 stop |
70 | $0 start | |
fba02342 | 71 | RETVAL=$? |
e781919f | 72 | [[ $imaprun -eq 1 ]] && /etc/rc.d/init.d/courier-imap start |
0e7557ae | 73 | [[ $poprun -eq 1 ]] && /etc/rc.d/init.d/courier-pop3 start |
e781919f | 74 | [[ $crun -eq 1 ]] && /etc/rc.d/init.d/courier-mta start |
75 | unset crun | |
76 | unset poprun | |
77 | unset imaprun | |
a0c812d1 | 78 | ;; |
79 | status) | |
80 | status authdaemond.$METHOD | |
81 | ;; | |
82 | *) | |
7ea5697f | 83 | msg_usage "$0 {start|stop|restart|reload|status}" |
a0c812d1 | 84 | exit 1 |
85 | esac | |
86 | ||
87 | exit $RETVAL | |
88 |