]>
Commit | Line | Data |
---|---|---|
e93af56d | 1 | #!/bin/sh |
373c74bd | 2 | # Courier IMAP Daemon |
e93af56d | 3 | # |
4 | # chkconfig: 345 80 20 | |
373c74bd | 5 | # description: Courier IMAP Daemon |
e93af56d | 6 | |
7efa8e76 AA |
7 | sysconfdir=@sysconfdir@ |
8 | libexecdir=@libexecdir@ | |
9 | sbindir=@sbindir@ | |
dc7a4eaf | 10 | |
e93af56d | 11 | # Source function library |
12 | . /etc/rc.d/init.d/functions | |
13 | ||
14 | # Get network config | |
15 | . /etc/sysconfig/network | |
16 | ||
0883df5e AM |
17 | # Get service config |
18 | [ -f /etc/sysconfig/courier-imap ] && . /etc/sysconfig/courier-imap | |
19 | ||
e93af56d | 20 | # Check that networking is up. |
0838e112 | 21 | if is_yes "${NETWORKING}"; then |
ac84c9b5 | 22 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then |
0838e112 | 23 | msg_network_down "Courier IMAP" |
24 | exit 1 | |
25 | fi | |
26 | else | |
27 | exit 0 | |
e93af56d | 28 | fi |
29 | ||
5521bbec | 30 | start() { |
e93af56d | 31 | # Check if the service is already running? |
5521bbec | 32 | if [ -f /var/lock/subsys/courier-imap ]; then |
373c74bd | 33 | msg_already_running "Courier IMAP" |
5521bbec | 34 | return |
e93af56d | 35 | fi |
5521bbec ER |
36 | |
37 | msg_starting "Courier IMAP" | |
38 | daemon $libexecdir/imapd.rc start | |
39 | RETVAL=$? | |
40 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/courier-imap | |
41 | } | |
42 | ||
43 | stop() { | |
44 | if [ ! -f /var/lock/subsys/courier-imap ]; then | |
373c74bd | 45 | msg_not_running "Courier IMAP" |
5521bbec | 46 | return |
1986fe76 | 47 | fi |
5521bbec ER |
48 | |
49 | msg_stopping "Courier IMAP" | |
50 | daemon $libexecdir/imapd.rc stop | |
51 | RETVAL=$? | |
52 | rm -f /var/lock/subsys/courier-imap >/dev/null 2>&1 | |
53 | } | |
54 | ||
55 | condrestart() { | |
56 | if [ ! -f /var/lock/subsys/courier-imap ]; then | |
57 | msg_not_running "Courier IMAP" | |
58 | RETVAL=$1 | |
59 | return | |
60 | fi | |
61 | ||
62 | stop | |
63 | start | |
64 | } | |
65 | ||
66 | RETVAL=0 | |
67 | # See how we were called. | |
68 | case "$1" in | |
69 | start) | |
70 | start | |
e93af56d | 71 | ;; |
5521bbec ER |
72 | stop) |
73 | stop | |
74 | ;; | |
75 | restart) | |
76 | stop | |
77 | start | |
78 | ;; | |
79 | force-reload) | |
80 | condrestart 7 | |
e93af56d | 81 | ;; |
5521bbec | 82 | status) |
373c74bd | 83 | # FIXME: matches other services, like courier-imap-ssl |
e93af56d | 84 | status couriertcpd |
d5f9e77f | 85 | exit $? |
e93af56d | 86 | ;; |
862484de | 87 | *) |
d5f9e77f | 88 | msg_usage "$0 {start|stop|restart|force-reload|status}" |
89 | exit 3 | |
e93af56d | 90 | esac |
91 | ||
1986fe76 | 92 | exit $RETVAL |