#! /bin/sh #---------------------------------------------------------------------------- # /etc/init.d/cron - init script for cron # # Creation: 2005-04-12 fm # Last Update: $Id$ # # Copyright (c) 2001-2010 the eisfair team, team(at)eisfair(dot)org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- NAME=fcron DAEMON=/usr/sbin/${NAME} PIDFILE=/var/run/${NAME}.pid . /etc/config.d/cron if [ ! -d /var/spool/fcron ] then ${DAEMON} -n /var/spool/fcron fi cron_is_running() { ret=1 if [ -e ${PIDFILE} ] then if [ "`pgrep -o ${NAME}`" = `cat ${PIDFILE}` ] then ret=0 fi fi return ${ret} } cron_start() { if [ ${START_CRON} = 'yes' ] then /usr/local/bin/colecho "Starting cron" gn ${DAEMON} fi } cron_stop() { if cron_is_running then /usr/local/bin/colecho "Stopping CRON" gn kill `cat ${PIDFILE} 2>/dev/null` 2>/dev/null else echo "CRON is not running" gn fi } cron_reload() { if cron_is_running then /usr/local/bin/colecho "Reloading CRON configuration" gn kill -USR1 `cat ${PIDFILE} 2>/dev/null` 2>/dev/null else echo -n "Cron is not running.." cron_start fi } cron_restart() { /usr/local/bin/colecho "Restarting CRON" gn cron_stop >/dev/null 2>&1 sleep 2 cron_start >/dev/null } cron_status() { if cron_is_running then echo "Cron is running" else echo "Cron is not running" fi } cron_usage() { echo "Usage: ${0} {start|stop|reload|restart|status}" exit 1 } case "${1}" in start) cron_start ;; stop) cron_stop ;; reload) cron_reload ;; force-reload) cron_reload ;; restart) cron_restart ;; status) cron_status ;; *) cron_usage ;; esac exit 0