#!/sbin/openrc-run
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

depend() {
	use logger clock hostname
	provide cron
}

start() {
	ebegin "Starting ${SVCNAME}"
 	mkdir -p /run/cron
	/usr/sbin/crond ${DCRON_OPTS}
	eend $?
}

stop() {
	ebegin "Stopping ${SVCNAME}"
	# adapted from /etc/rc.d/rc.crond
	/usr/bin/pkill --ns $$ --euid root -f "^/usr/sbin/crond" 2> /dev/null
	local ret=$?
	rm -f /run/crond.pid
	eend ${ret}
}
