aboutsummaryrefslogtreecommitdiffstats
path: root/main/dovecot/dovecot.initd
blob: 92959c6372c9d7fdef98e06ebe8a89e53adddc58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/sbin/openrc-run

[ "${SVCNAME}" != "${SVCNAME##*.}" ] && instance=${SVCNAME##*.}

description="Secure POP3/IMAP server"

cfgfile=/etc/dovecot/dovecot${instance:+.$instance}.conf
pidfile=$(doveconf -c $cfgfile -h base_dir 2>/dev/null)/master.pid
command=/usr/sbin/dovecot
command_args=${instance:+-c $cfgfile}
required_files="$cfgfile"
extra_started_commands="reload reopen"
description_reload="Reload configuration"
description_reopen="Reopen log files"

depend() {
	need localmount net
	before mta
	after bootmisc firewall ldap mysql ntp-client ntpd postgresql saslauthd slapd
	use logger
}

start_pre() {
	ebegin
	doveconf -c $cfgfile -x >/dev/null && \
		checkpath --directory ${pidfile%/*}
	eend $?
}

reload() {
	ebegin "Reloading ${SVCNAME} configs and restarting auth/login processes"
	start_pre && start-stop-daemon --signal HUP --pidfile $pidfile
	eend $?
}

reopen() {
	ebegin "Reopening ${SVCNAME} log files"
	start-stop-daemon --signal USR1 --pidfile $pidfile
	eend $?
}