From /etc/cron.daily/apt-compat:
Systemd systems use a systemd timer unit which is preferable to
# run. We want to randomize the apt update and unattended-upgrade
# runs as much as possible to avoid hitting the mirrors all at the
# same time. The systemd time is better at this than the fixed
# cron.daily time
Code:
...# sleep for a random interval of time (default 30min)# (some code taken from cron-apt, thanks)random_sleep(){ RandomSleep=1800 eval $(apt-config shell RandomSleep APT::Periodic::RandomSleep) if [ $RandomSleep -eq 0 ]; thenreturn fi if [ -z "$RANDOM" ] ; then # A fix for shells that do not have this bash feature.RANDOM=$(( $(dd if=/dev/urandom bs=2 count=1 2> /dev/null | cksum | cut -d' ' -f1) % 32767 )) fi TIME=$(($RANDOM % $RandomSleep)) sleep $TIME}# delay the job execution by a random amount of timerandom_sleep...
Statistics: Posted by Uptorn — 2024-12-05 14:20