Wednesday, 9 May 2012

Downloading updates to openSUSE during off-peak times using zypper

You might, like me, have an ISP that has peak and off-peak quotas. I prefer to consume off-peak quota whenever possible to leave more for waking hours.


My openSUSE installation gets regular package updates. Since I want every update in any case I looked for a way to download the packages ahead of time during off-peak. It turned out to be quite easy, as root I just created a file in /etc/cron.d/zypper-offpeak containing one line:



6 6 * * * root zypper -n up -l -d > /dev/null 2>&1


See man crontab for an explanation of the fields. This runs at 0606 in the morning. The -n allows it to run non-interactively, the -l auto-agrees with licenses (usually Adobe Reader plugin), and -d is the magic, meaning download only.


The packages go into the normal package cache, and next time you do a zypper up, they will install straight away. This makes for faster updates and the savings can be considerable for kernel-source and VirtualBox packages.


This has already been blogged here citing a different motivation. The correct answer is in one of the comments, apparently -d or --download-only was not in old versions of zypper.

No comments:

Post a Comment