pentoo-overlay/net-mail/davmail-bin/files/davmail.init
Erik Quaeghebeur 94acb4f14f
properly add and cleanup net-mail/davmail init scripts
* systemd unit files are installed with the systemd_dounit function
* systemd unit files do not have an extra conf file extension
* small files like systemd unit files do not merit a separate use flag (Gentoo policy)
* \#!/sbin/runscript is deprecated, \#!/sbin/openrc-run should be used instead
2020-10-06 09:56:22 +02:00

33 lines
612 B
Text

#!/sbin/openrc-run
PN="davmail"
USER="${PN}"
PID_FILE="/var/run/${PN}.pid"
RUN_FILE="/usr/bin/${PN}"
depend() {
need net
}
checkconfig() {
if [ ! -e ${DAVMAIL_CONF} ]; then
eerror "You need to have a valid configuration file at ${DAVMAIL_CONF}"
return 1
fi
}
start() {
checkconfig || return 1
ebegin "Starting DavMail gateway"
start-stop-daemon --start --user ${USER} \
--pidfile ${PID_FILE} --make-pidfile --background \
--exec ${RUN_FILE} -- ${DAVMAIL_CONF}
eend $?
}
stop() {
ebegin "Shutting down DavMail gateway"
start-stop-daemon --stop --user ${USER} --pidfile ${PID_FILE}
eend $?
}