]>
Commit | Line | Data |
---|---|---|
7987a9db TO |
1 | #!/bin/sh |
2 | # IMAP Daemon | |
3 | # | |
4 | # chkconfig: 345 80 20 | |
5 | # description: IMAP Daemon | |
6 | ||
7 | # Source function library | |
8 | . /etc/rc.d/init.d/functions | |
9 | ||
10 | # Get network config | |
11 | . /etc/sysconfig/network | |
12 | ||
13 | # Get service config | |
14 | [ -f /etc/sysconfig/dovecot ] && . /etc/sysconfig/dovecot | |
15 | ||
16 | # Check that networking is up. | |
17 | if is_yes "${NETWORKING}"; then | |
18 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then | |
19 | msg_network_down "Dovecot" | |
20 | exit 1 | |
21 | fi | |
22 | else | |
23 | exit 0 | |
24 | fi | |
25 | ||
26 | RETVAL=0 | |
27 | # See how we were called. | |
28 | case "$1" in | |
29 | start) | |
30 | # Check if the service is already running? | |
31 | if [ ! -f /var/lock/subsys/dovecot ]; then | |
32 | msg_starting "Dovecot" | |
33 | daemon /usr/sbin/dovecot | |
34 | RETVAL=$? | |
35 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dovecot | |
36 | else | |
37 | msg_already_running "Dovecot" | |
7987a9db TO |
38 | fi |
39 | ;; | |
40 | stop) | |
41 | if [ -f /var/lock/subsys/dovecot ]; then | |
42 | msg_stopping "Dovecot" | |
43 | killproc dovecot | |
44 | rm -f /var/lock/subsys/dovecot | |
45 | else | |
46 | msg_not_running "Dovecot" | |
47 | fi | |
48 | ;; | |
11c5c1e4 | 49 | restart|force-reload) |
7987a9db TO |
50 | $0 stop |
51 | $0 start | |
52 | exit $? | |
53 | ;; | |
54 | status) | |
55 | status dovecot | |
56 | exit $? | |
57 | ;; | |
58 | *) | |
59 | msg_usage "$0 {start|stop|restart|force-reload|status}" | |
60 | exit 3 | |
61 | esac | |
62 | ||
63 | exit $RETVAL |