]>
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 | ||
f5ee3746 | 26 | start() { |
7987a9db TO |
27 | # Check if the service is already running? |
28 | if [ ! -f /var/lock/subsys/dovecot ]; then | |
29 | msg_starting "Dovecot" | |
30 | daemon /usr/sbin/dovecot | |
31 | RETVAL=$? | |
32 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dovecot | |
33 | else | |
34 | msg_already_running "Dovecot" | |
7987a9db | 35 | fi |
f5ee3746 ER |
36 | } |
37 | ||
38 | stop() { | |
39 | if [ -f /var/lock/subsys/dovecot ]; then | |
7987a9db TO |
40 | msg_stopping "Dovecot" |
41 | killproc dovecot | |
42 | rm -f /var/lock/subsys/dovecot | |
43 | else | |
44 | msg_not_running "Dovecot" | |
45 | fi | |
f5ee3746 ER |
46 | } |
47 | ||
48 | RETVAL=0 | |
49 | # See how we were called. | |
50 | case "$1" in | |
51 | start) | |
52 | start | |
53 | ;; | |
54 | stop) | |
55 | stop | |
7987a9db | 56 | ;; |
11c5c1e4 | 57 | restart|force-reload) |
f5ee3746 ER |
58 | stop |
59 | start | |
7987a9db | 60 | ;; |
b9e08f0f ER |
61 | reload) |
62 | msg_reloading "Dovecot" | |
63 | killproc dovecot -HUP | |
64 | exit $? | |
65 | ;; | |
7987a9db TO |
66 | status) |
67 | status dovecot | |
68 | exit $? | |
69 | ;; | |
70 | *) | |
b9e08f0f | 71 | msg_usage "$0 {start|stop|reload|restart|force-reload|status}" |
7987a9db TO |
72 | exit 3 |
73 | esac | |
74 | ||
75 | exit $RETVAL |