This repository has been archived on 2026-01-16. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
anacron/anacron.init
2007-12-11 08:09:04 +00:00

82 lines
1.4 KiB
Bash
Executable file

#!/bin/sh
# Startup script for anacron
#
# chkconfig: 2345 99 05
# description: Run cron jobs that were left out due to downtime
# pidfile: /var/run/anacron.pid
#
# Source function library.
. /etc/rc.d/init.d/functions
[ -f /usr/sbin/anacron ] || exit 0
prog="anacron"
PIDFILE=/var/spool/anacron/cron.daily
LOCKFILE=/var/lock/subsys/$prog
#
# NOTE: anacron exits after it has determined it has no more work to do.
# Hence, its initscript cannot do normal lock file management.
# The anacron binary now creates its own timestamps in files
# /var/spool/anacron/cron.{daily,monthly,weekly}
# and /var/lock/subsys lock files.
#
start() {
echo -n $"Starting $prog: "
daemon +19 anacron -s
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
failure;
fi;
echo
}
stop() {
echo -n $"Stopping $prog: "
if [ -f $PIDFILE ]; then
killproc anacron
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
failure;
fi;
else
failure;
fi
echo
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
## hard to say - anacron is up only when cron wake him
status $prog
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if [ -f /var/lock/subsys/anacron ]; then
stop
sleep 2
start
fi
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
RETVAL=3
esac
exit $RETVAL