X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/4a858c3921aabe5253204063bedb2307a60f30e0..5ef499349c609f5ef50bd633692faa2665f4f96f:/debian/apt.cron.daily diff --git a/debian/apt.cron.daily b/debian/apt.cron.daily index 2f1a59744..f4eb6117a 100644 --- a/debian/apt.cron.daily +++ b/debian/apt.cron.daily @@ -147,7 +147,7 @@ check_size_constraints() fi } -# sleep for a random intervall of time (default 30min) +# sleep for a random interval of time (default 30min) # (some code taken from cron-apt, thanks) random_sleep() { @@ -193,8 +193,17 @@ if which on_ac_power >/dev/null; then fi # check if we can lock the cache and if the cache is clean +# There's a reasonable chance that someone is already running an apt +# frontend that has locked the cache, so exit quietly if it is locked. +if ! apt-get check -q -q 2>/dev/null; then + exit 0 +fi + +# sleep random amount of time +random_sleep + +# check again if we can access the cache if ! apt-get check -q -q 2>/dev/null; then - echo "$0: could not lock the APT cache" exit 1 fi