diff options
Diffstat (limited to 'sys-process/fcron/files/fcron.init')
-rwxr-xr-x | sys-process/fcron/files/fcron.init | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/sys-process/fcron/files/fcron.init b/sys-process/fcron/files/fcron.init new file mode 100755 index 000000000000..61a2ed1666dd --- /dev/null +++ b/sys-process/fcron/files/fcron.init @@ -0,0 +1,50 @@ +#!/sbin/runscript +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-process/fcron/files/fcron.init,v 1.1 2006/06/20 19:44:58 wschlich Exp $ + +depend() { + use logger slapd mysql postgresql + need clock hostname + # provide the cron service if we are the main instance + if [ "${SVCNAME}" == "fcron" ]; then + provide cron + fi +} + +checkconfig() { + FCRON_INSTANCE=${SVCNAME##*.} + if [[ -n "${FCRON_INSTANCE}" && "${SVCNAME}" != "fcron" ]]; then + FCRON_CONF=/etc/fcron/fcron.${FCRON_INSTANCE}.conf + else + FCRON_CONF=/etc/fcron/fcron.conf + fi + if [ ! -e ${FCRON_CONF} ]; then + eerror "You will need an ${FCRON_CONF} first" + eerror "There is a sample in /etc/fcron" + return 1 + fi + FCRON_PIDFILE=$(grep '^pidfile' ${FCRON_CONF} 2>/dev/null | sed -e 's:^pidfile\s*=\s*\(.*\)$:\1:') + FCRON_PIDFILE=${FCRON_PIDFILE:-/var/run/fcron.pid} + FCRON_SPOOLDIR=$(grep '^fcrontabs' ${FCRON_CONF} 2>/dev/null | sed -e 's:^fcrontabs\s*=\s*\(.*\)$:\1:') + FCRON_SPOOLDIR=${FCRON_SPOOLDIR:-/var/spool/cron/fcrontabs} + if [ ! -d ${FCRON_SPOOLDIR} ]; then + ebegin "Creating missing spooldir ${FCRON_SPOOLDIR}" + /usr/sbin/fcron --newspooldir ${FCRON_SPOOLDIR} + eend $? + fi +} + +start() { + checkconfig || return 1 + ebegin "Starting ${SVCNAME}" + start-stop-daemon --start --pidfile ${FCRON_PIDFILE} --exec /usr/sbin/fcron -- -c ${FCRON_CONF} + eend $? +} + +stop() { + checkconfig || return 1 + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop --pidfile ${FCRON_PIDFILE} + eend $? +} |