]> git.pld-linux.org Git - packages/dovecot.git/blame - dovecot.init
- up to 2.1.10
[packages/dovecot.git] / dovecot.init
CommitLineData
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.
17if 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
22else
23 exit 0
24fi
25
f5ee3746 26start() {
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
38stop() {
39 if [ -f /var/lock/subsys/dovecot ]; then
7987a9db 40 msg_stopping "Dovecot"
57b4dddc 41 killproc --pidfile dovecot/master.pid dovecot
7987a9db
TO
42 rm -f /var/lock/subsys/dovecot
43 else
44 msg_not_running "Dovecot"
45 fi
f5ee3746
ER
46}
47
4e568659
JB
48reload() {
49 if [ -f /var/lock/subsys/dovecot ]; then
3a49c488 50 msg_reloading dovecot
57b4dddc 51 killproc --pidfile dovecot/master.pid docevot -HUP
4e568659
JB
52 RETVAL=$?
53 else
54 msg_not_running "Dovecot"
55 RETVAL=7
56 fi
57}
58
59condrestart() {
60 if [ -f /var/lock/subsys/dovecot ]; then
61 stop
62 start
63 else
64 msg_not_running "Dovecot"
65 RETVAL=$1
66 fi
67}
68
f5ee3746
ER
69RETVAL=0
70# See how we were called.
71case "$1" in
72 start)
73 start
74 ;;
75 stop)
76 stop
7987a9db 77 ;;
4e568659 78 restart)
f5ee3746
ER
79 stop
80 start
7987a9db 81 ;;
4e568659
JB
82 try-restart)
83 condrestart 0
84 ;;
85 reload|force-reload)
86 reload
b9e08f0f 87 ;;
7987a9db
TO
88 status)
89 status dovecot
90 exit $?
91 ;;
92 *)
4e568659 93 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
7987a9db
TO
94 exit 3
95esac
96
97exit $RETVAL
This page took 0.035953 seconds and 4 git commands to generate.