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