#! /bin/sh
# /etc/init.d/anacron: start anacron
#

PATH=/bin:/usr/bin:/sbin:/usr/sbin

test -f /usr/sbin/anacron || exit 0

case "$1" in
  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
        echo -n "Starting anac(h)ronistic cron: anacron"
        anacron -s
        echo "."
    else       
        echo "Starting anac(h)ronistic cron: deferred while on battery power."
    fi
    ;;
  restart|force-reload|stop)
  	# nothing to do
    :
    ;;
  *)
    echo "Usage: /etc/init.d/anacron start"
    exit 1
    ;;
esac

exit 0
