#!/bin/sh # Startup script for anacron # # chkconfig: 2345 95 92 # description: Run cron jobs that were left out due to downtime # 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 anacron: " daemon anacron RETVAL=$? echo if test $RETVAL == 0; then touch /var/lock/subsys/anacron fi else exit 0 fi return $RETVAL } stop() { gprintf "Shutting down anacron " 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: anacron {start|stop|restart|condrestart|status}\n" exit 1 esac exit 0