#!/bin/sh

# PROVIDE: anacron
# REQUIRE: LOGIN
# KEYWORD: resume

#
# Execute one of the following commands as root to enable anacron:
#
#    service anacron enable
#    sysrc anacron_enable=YES
#

. /etc/rc.subr

name=anacron
command="/usr/local/sbin/anacron"
desc="Schedules periodic jobs on systems that are not permanently up"
extra_commands=resume
rcvar=anacron_enable
required_vars=syslogd_enable

load_rc_config $name
: ${anacron_enable:=NO}

if [ $# -gt 0 -a $1 = "resume" ]; then
   arg=start
   if checkyesno $rcvar; then
       info "starting ${name} after resume"
   fi
else
   arg=$1
fi
debug "$name: \$1 = $1, arg = $arg"

run_rc_command "$arg"
