|
@@ -72,18 +72,6 @@
|
|
|
# 2: + command outputs (remove -qq, remove 2>/dev/null, add -d)
|
|
|
# 3: + trace on
|
|
|
#
|
|
|
-# APT::Periodic::RandomSleep "1800";
|
|
|
-# - The apt cron job will delay its execution by a random
|
|
|
-# time span between zero and 'APT::Periodic::RandomSleep'
|
|
|
-# seconds.
|
|
|
-# This is done because otherwise everyone would access the
|
|
|
-# mirror servers at the same time and put them collectively
|
|
|
-# under very high strain.
|
|
|
-# You can set this to '0' if you are using a local mirror and
|
|
|
-# do not care about the load spikes.
|
|
|
-# Note that sleeping in the apt job will be delaying the
|
|
|
-# execution of all subsequent cron.daily jobs.
|
|
|
-#
|
|
|
|
|
|
check_stamp()
|
|
|
{
|
|
@@ -294,25 +282,6 @@ do_cache_backup()
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
-# 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 ]; then
|
|
|
- return
|
|
|
- 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))
|
|
|
- debug_echo "sleeping for $TIME seconds"
|
|
|
- sleep $TIME
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
debug_echo()
|
|
|
{
|
|
|
# Display message if $VERBOSE >= 1
|
|
@@ -440,9 +409,7 @@ fi
|
|
|
# deal with BackupArchiveInterval
|
|
|
do_cache_backup $BackupArchiveInterval
|
|
|
|
|
|
-# sleep random amount of time to avoid hitting the
|
|
|
-# mirrors at the same time
|
|
|
-random_sleep
|
|
|
+# ensure we don't do this on battery
|
|
|
check_power || exit 0
|
|
|
|
|
|
# include default system language so that "apt-get update" will
|