[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: update system periodically



On Sun 21 Jul 2024 at 22:01:58 (-0600), Charles Curley wrote:
> On Sun, 21 Jul 2024 18:43:28 -0500
> David Wright <deblis@lionunicorn.co.uk> wrote:
> 
> > I run the following from root's crontab:
> > 
> >   apt-get -qq -o Acquire::http::Proxy="http://192.168.1.14:3142/";
> >   update && apt-get -qq -d -o
> > Acquire::http::Proxy="http://192.168.1.14:3142/"; dist-upgrade && find
> > /var/cache/apt/archives/ -name '*deb'
> > 
> > (That's all on one line.)
> 
> Suggestion: rather than have the
> "Acquire::http::Proxy="http://192.168.1.14:3142/"; in the command, use
> the package auto-apt-proxy to detect proxy servers for you.

I might have, had it existed at the time I wrote this. (My cron
line has been around for more than a couple of decades, as has
my use of proxies.)

> Suggestion: rather than run it from cron (or a systemd timer), look
> into unattended-upgrades.

For the OP, I would rather recommend cron-apt. I was a little guarded
in my previous advice as the OP has dabbled with ubuntu and might have
installed packages other than pure Debian 11, so automatic upgrades
themselves might be unwise. The OP is also learning to write scripts,
so a one-liner like mine might be attractive.

When an email has been generated, I use the following scripts to
perform the upgrades. (To complete the set of APT commands I run
as root, I include the fourth line. Each one is on a single line.)

# apt-get -o Acquire::http::Proxy="http://192.168.1.14:3142/";
  update && apt-get -d -o Acquire::http::Proxy="http://192.168.1.14:3142/";
  dist-upgrade; apt-get upgrade; read -p 'Ctrl-C to avoid clean' _;
  apt-get clean

# apt-get -d -o Acquire::http::Proxy="http://192.168.1.14:3142/";
  dist-upgrade && apt-get dist-upgrade ; read -p 'Ctrl-C to avoid
  clean' _; apt-get clean

# apt-get --purge autoremove # take care as this can uninstall lots

# apt-get -s -o Acquire::http::Proxy="http://192.168.1.14:3142/";
  install xxx

Call me old-school.

Cheers,
David.


Reply to: