#!/bin/bash # wait for 3:02 when /etc/crontab runs cron.daily if [ `date +%H` -le 4 ]; then exit 0; fi #delay - more computers on one line don't receive updates at the same time [ -f /etc/sysconfig/crontab ] && . /etc/sysconfig/crontab if [ ! -z "$DELAY" ]; then if [ "$DELAY" != "0" ]; then # Create md5sum of hostname (static over system lifetime) md5sum="`echo ${HOSTNAME} | md5sum`" # Extract the first 3 hexdigits (12 Bit: 0-4095) hexvalue="${md5sum:0:3}" # Create decimal value decvalue="`printf "%d" "0x${hexvalue}"`" # Divide delay by factor T_DELAY=$[ ${decvalue} / ${DELAY} ] sleep $T_DELAY fi fi # in case anacron is already running, # there will be log (daemon won't be running twice). if test -x /usr/bin/on_ac_power; then /usr/bin/on_ac_power &> /dev/null if test $? -eq 1; then exit 0 fi fi /usr/sbin/anacron -s