On Sat, 03 May 2008 15:08:46 +0200 Goswin von Brederlow wrote: > Otavio Salvador <[EMAIL PROTECTED]> writes: > > > Francesco Poli <[EMAIL PROTECTED]> writes: [...] > >> If /etc/cron.daily/apt has something to do on the system (because APT > >> was configured accordingly), then, when the cache cannot be > >> locked, /etc/cron.daily/apt cannot do its job and it should indeed exit > >> *with errors* to alert the administrator that something went wrong! > > Does it at least wait a while? It is a daily jobs and if it runs an > hour late because the cache was locked nobody will mind. An error mail > just because apt-get was in use at the time cron.daily triggered is > anoying though.
No, it currently does not wait. It just gives up and exits. A wait & retry mechanism could be implemented, but... will it delay the remaining cron daily jobs, as well? Something like the following, so to speak: # if needed... if [ ! $UpdateInterval -eq 0 ] || [ ! $DownloadUpgradeableInterval -eq 0 ] || [ ! $UnattendedUpgradeInterval -eq 0 ] || [ ! $AutocleanInterval -eq 0 ]; then # check if we can lock the cache and if the cache is clean if ! apt-get check -q -q 2>/dev/null; then sleep $LockedCacheRetryDelay # retry if ! apt-get check -q -q 2>/dev/null; then echo "$0: could not lock the APT cache" exit 1 fi fi fi where LockedCacheRetryDelay is the delay length (in seconds) and should be set at the beginning of the script, or, even better, turned into an APT configuration variable... Possible value: LockedCacheRetryDelay=900 # 15 minutes Once again, to the extent it is copyrighted, I hereby release the above code fragment under the same terms of /etc/cron.daily/apt, that is to say, under the terms of the GNU General Public License (GPL), version 2 or later, as published by the Free Software Foundation. -- http://frx.netsons.org/doc/index.html#nanodocs The nano-document series is here! ..................................................... Francesco Poli . GnuPG key fpr == C979 F34B 27CE 5CD8 DC12 31B5 78F4 279B DD6D FCF4
pgpyzEJCjOf34.pgp
Description: PGP signature