On Sun, May 30, 2021 at 01:08:18PM +0200, Stella Ashburne wrote:
> Question: Is it a prerequisite (pre-condition) that to set up a cron job to 
> download updates at a fixed time every day, the OS must have the installed 
> package "unattended-upgrades"?

Nope.  You can write your own cron job to do it.

The thing is, the simple and obvious way to do it via cron is slightly
dangerous.  When cron runs apt-get or apt or whatever you choose, *you*
have no ability to interact with it.  If a package comes with a
NEWS.Debian.gz file that it wants to display to you to warn you about
some new incompatible change, or if it wants to ask you whether it should
replace a conffile that has been altered, or *any* kind of question,
it can't.

So, the simple and obvious workaround for that, when writing a cron job
to do this, would be to use apt-get's "-y" flag.

This may not do what you want in all situations.

On the other hand, your question is interesting, in that it says "download
updates", not "install updates".  If you really do mean "download the
packages and let them sit in /var/cache but don't install them", then
there's no danger.  You can write a cron job to do that, no problem at
all.

Of course, then the question becomes one of your workflow.  Are you going
to look in /var/cache/apt/archives/ yourself once a day, to see whether
there's a new file there?  Are you going to set up your cron job to email
you whenever a package is downloaded?  Are you simply going to run
"apt-get -u upgrade" or some equivalent once a day?  There are lots of
possibilities here.  You just have to decide what you want, and then
implement it.

Reply via email to