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