]>
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 | ||
d5f9e77f | 30 | RETVAL=0 |
e93af56d | 31 | # See how we were called. |
32 | case "$1" in | |
862484de | 33 | start) |
e93af56d | 34 | # Check if the service is already running? |
35 | if [ ! -f /var/lock/subsys/courier-imap ]; then | |
373c74bd | 36 | msg_starting "Courier IMAP" |
862484de | 37 | daemon $libexecdir/imapd.rc start |
6b435ac0 AM |
38 | RETVAL=$? |
39 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/courier-imap | |
e93af56d | 40 | else |
373c74bd | 41 | msg_already_running "Courier IMAP" |
e93af56d | 42 | fi |
862484de ER |
43 | ;; |
44 | stop) | |
1986fe76 | 45 | if [ -f /var/lock/subsys/courier-imap ]; then |
373c74bd | 46 | msg_stopping "Courier IMAP" |
862484de ER |
47 | daemon $libexecdir/imapd.rc stop |
48 | RETVAL=$? | |
6b435ac0 | 49 | rm -f /var/lock/subsys/courier-imap >/dev/null 2>&1 |
1986fe76 | 50 | else |
373c74bd | 51 | msg_not_running "Courier IMAP" |
1986fe76 | 52 | fi |
e93af56d | 53 | ;; |
862484de | 54 | restart|force-reload) |
e93af56d | 55 | $0 stop |
56 | $0 start | |
d5f9e77f | 57 | exit $? |
e93af56d | 58 | ;; |
862484de | 59 | status) |
373c74bd | 60 | # FIXME: matches other services, like courier-imap-ssl |
e93af56d | 61 | status couriertcpd |
d5f9e77f | 62 | exit $? |
e93af56d | 63 | ;; |
862484de | 64 | *) |
d5f9e77f | 65 | msg_usage "$0 {start|stop|restart|force-reload|status}" |
66 | exit 3 | |
e93af56d | 67 | esac |
68 | ||
1986fe76 | 69 | exit $RETVAL |