#!/bin/sh # Startup script for anacron # # chkconfig: 2345 95 92 # description: Run cron jobs that were left out due to downtime # ### BEGIN INIT INFO # Provides: anacron # Should-Start: haldaemon # Default-Start: 2 3 4 5 # Short-Description: Run cron jobs that were left out due to downtime # Description: Run cron jobs that were left out due to downtime ### END INIT INFO # define gprintf for distros without it: gprintf() { printf -- "$@" } prog=anacron # Source function library. . /etc/rc.d/init.d/functions [ -f /usr/sbin/anacron ] || exit 0 start() { # Really on_ac_power is not a sufficient test, as it only looks at # APM and we ought to also check whether we're on a UPS battery. if test \! -x /usr/bin/on_ac_power || on_ac_power >/dev/null then gprintf "Starting %s: " "$prog" daemon anacron RETVAL=$? echo if test $RETVAL == 0; then touch /var/lock/subsys/anacron fi else exit 0 fi return $RETVAL } stop() { gprintf "Stopping %s: " "$prog" if test "x`pidof anacron`" != x then killproc anacron else success "anacron shutdown" fi echo rm -f /var/lock/subsys/anacron return 0 } case "$1" in start) start ;; stop) stop ;; status) status anacron ;; reload) ;; restart) stop start ;; condrestart) if test "x`pidof anacron`" != x; then stop start fi ;; *) gprintf "Usage: %s\n" "$prog {start|stop|restart|condrestart|status}" exit 1 esac exit 0