I'm ok with the random sleep to avoid hitting the mirrors too hard, but you missed my point.
Debian's cron.daily/apt (from sid's apt 0.7.20.2) sleeps a random amount of time, up to 30 minutes. Ubuntu's cron.daily/apt (from Jaunty's apt 0.7.20.2ubuntu2) sleeps *TWICE*. There is a bit of seemingly duplicated code in the script. Here is a snippet from Debian's apt 0.7.20.2. Note how random_sleep is called only *ONCE*. """ # sleep random amount of time to avoid hitting the # mirrors at the same time random_sleep # check if we can access the cache if ! apt-get check -q -q 2>/dev/null; then # wait random amount of time before retrying random_sleep # check again if ! apt-get check -q -q 2>/dev/null; then echo "$0: could not lock the APT cache while performing daily cron job. " echo "Is another package manager working?" exit 1 fi fi UPDATE_STAMP=/var/lib/apt/periodic/update-stamp if check_stamp $UPDATE_STAMP $UpdateInterval; then if apt-get -qq update 2>/dev/null; then [...] """ Here is a snippet from Ubuntu's apt 0.7.20.2ubuntu2. Note how random_sleep is called *TWICE*, both before and after checking the proxy settings in gconf. Note also how the (duplicated) code performing the sleep and the cache check is exactly the same: it looks like a patch adding the random sleep feature has slipped in *TWICE*. """ # 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 exit 1 fi # set the proxy based on the admin users gconf settings admin_user=$(getent group admin|cut -d: -f4|cut -d, -f1) if [ -n "$admin_user" ] && [ -x /usr/bin/sudo ] && [ -z "$http_proxy" ] && [ -x /usr/bin/gconftool ]; then use=$(sudo -u "$admin_user" gconftool --get /system/http_proxy/use_http_proxy) host=$(sudo -u "$admin_user" gconftool --get /system/http_proxy/host) port=$(sudo -u "$admin_user" gconftool --get /system/http_proxy/port) if [ "$use" = "true" ] && [ -n "$host" ] && [ -n "$port" ]; then export http_proxy="http://$host:$port/" fi 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 exit 1 fi UPDATE_STAMP=/var/lib/apt/periodic/update-stamp if check_stamp $UPDATE_STAMP $UpdateInterval; then # check for a new archive signing key (against the master keyring) apt-key net-update # now run the update if apt-get -qq update -o APT::Update::Auth-Failure::="cp /usr/share/apt/apt-auth-failure.note /var/lib/update-notifier/user.d/" 2>/dev/null; then [...] """ -- apt cron.daily script sleeps a random amount of time twice https://bugs.launchpad.net/bugs/262015 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs