#!/bin/bash
# managed by puppet
#
#!!! do not perform day checks here, cuz it would prevent hourly jobs from execution !!!
#in case file doesn't exist
#if test -r /var/spool/anacron/cron.daily; then
#    day=`cat /var/spool/anacron/cron.daily`
#fi
#if [ `date +%Y%m%d` = "$day" ]; then
#    exit 0;
#fi
#
# in case anacron is already running,
# there will be log (daemon won't be running twice).
if [[ -x /usr/bin/on_ac_power ]]; then
    /usr/bin/on_ac_power &> /dev/null
    if [[ $? -eq 1 ]]; then
        exit 0
    fi
fi
/usr/sbin/anacron -s
