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