]> git.pld-linux.org Git - packages/dovecot.git/blame_incremental - dovecot.init
- up to 2.3.9.1; fixes CVE-2019-19722 introduced in 2.3.9
[packages/dovecot.git] / dovecot.init
... / ...
CommitLineData
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
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
35start() {
36 # Check if the service is already running?
37 if [ ! -f /var/lock/subsys/dovecot ]; then
38 msg_starting "Dovecot"
39 daemon /usr/sbin/dovecot $DOVECOT_CFG
40 RETVAL=$?
41 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dovecot
42 else
43 msg_already_running "Dovecot"
44 fi
45}
46
47stop() {
48 if [ -f /var/lock/subsys/dovecot ]; then
49 msg_stopping "Dovecot"
50 killproc --pidfile dovecot/master.pid dovecot
51 rm -f /var/lock/subsys/dovecot
52 else
53 msg_not_running "Dovecot"
54 fi
55}
56
57reload() {
58 if [ -f /var/lock/subsys/dovecot ]; then
59 msg_reloading dovecot
60 killproc --pidfile dovecot/master.pid docevot -HUP
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
78RETVAL=0
79# See how we were called.
80case "$1" in
81 start)
82 start
83 ;;
84 stop)
85 stop
86 ;;
87 restart)
88 stop
89 start
90 ;;
91 try-restart)
92 condrestart 0
93 ;;
94 reload|force-reload)
95 reload
96 ;;
97 status)
98 status dovecot
99 exit $?
100 ;;
101 *)
102 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
103 exit 3
104esac
105
106exit $RETVAL
This page took 0.047431 seconds and 4 git commands to generate.