aports/main/dovecot/dovecot.initd
Jakub Jirutka 768dfffe30 main/dovecot: fix init script to not print irrelevant error
doveconf: Error: t_readlink(/run/dovecot/dovecot.conf) failed: readlink() failed: No such file or directory
2018-07-22 18:29:42 +02:00

40 lines
1,000 B
Bash

#!/sbin/openrc-run
[ "$RC_SVCNAME" != "${RC_SVCNAME##*.}" ] && instance=${RC_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 2>&1 && \
checkpath --directory ${pidfile%/*}
eend $?
}
reload() {
ebegin "Reloading $RC_SVCNAME configs and restarting auth/login processes"
start_pre && start-stop-daemon --signal HUP --pidfile $pidfile
eend $?
}
reopen() {
ebegin "Reopening $RC_SVCNAME log files"
start-stop-daemon --signal USR1 --pidfile $pidfile
eend $?
}