#!/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.2,v 1.1 2010/03/10 01:38:22 flameeyes Exp $ depend() { use logger 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}" -a "${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[[:space:]]*=[[:space:]]*\(.*\)$:\1:') FCRON_PIDFILE=${FCRON_PIDFILE:-/var/run/fcron.pid} FCRON_SPOOLDIR=$(grep '^fcrontabs' ${FCRON_CONF} 2>/dev/null | sed -e 's:^fcrontabs[[:space:]]*=[[:space:]]*\(.*\)$:\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 $? }