]> git.pld-linux.org Git - packages/dovecot.git/blame - dovecot.init
Release 3 (by relup.sh)
[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
9f6c4ad4
AM
26if [ -n "${DOVECOT_CONF}" ]; then
27 if [ -f "${DOVECOT_CONF}" ]; then
28 DOVECOT_CFG="-c ${DOVECOT_CONF}"
29 else
30 echo "error: DOVECOT_CONF='$DOVECOT_CONF': not a file"
31 exit 1
32 fi
33fi
34
f5ee3746 35start() {
7987a9db
TO
36 # Check if the service is already running?
37 if [ ! -f /var/lock/subsys/dovecot ]; then
38 msg_starting "Dovecot"
9f6c4ad4 39 daemon /usr/sbin/dovecot $DOVECOT_CFG
7987a9db
TO
40 RETVAL=$?
41 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dovecot
42 else
43 msg_already_running "Dovecot"
7987a9db 44 fi
f5ee3746
ER
45}
46
47stop() {
48 if [ -f /var/lock/subsys/dovecot ]; then
7987a9db 49 msg_stopping "Dovecot"
57b4dddc 50 killproc --pidfile dovecot/master.pid dovecot
7987a9db
TO
51 rm -f /var/lock/subsys/dovecot
52 else
53 msg_not_running "Dovecot"
54 fi
f5ee3746
ER
55}
56
4e568659
JB
57reload() {
58 if [ -f /var/lock/subsys/dovecot ]; then
3a49c488 59 msg_reloading dovecot
57b4dddc 60 killproc --pidfile dovecot/master.pid docevot -HUP
4e568659
JB
61 RETVAL=$?
62 else
63 msg_not_running "Dovecot"
64 RETVAL=7
65 fi
66}
67
68condrestart() {
69 if [ -f /var/lock/subsys/dovecot ]; then
70 stop
71 start
72 else
73 msg_not_running "Dovecot"
74 RETVAL=$1
75 fi
76}
77
f5ee3746
ER
78RETVAL=0
79# See how we were called.
80case "$1" in
81 start)
82 start
83 ;;
84 stop)
85 stop
7987a9db 86 ;;
4e568659 87 restart)
f5ee3746
ER
88 stop
89 start
7987a9db 90 ;;
4e568659
JB
91 try-restart)
92 condrestart 0
93 ;;
94 reload|force-reload)
95 reload
b9e08f0f 96 ;;
7987a9db
TO
97 status)
98 status dovecot
99 exit $?
100 ;;
101 *)
4e568659 102 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
7987a9db
TO
103 exit 3
104esac
105
106exit $RETVAL
This page took 0.163897 seconds and 4 git commands to generate.