[raspberry-vi] Re: How to configure unattended-upgrades for rpi

  • From: "Michael A Ray" <dmarc-noreply@xxxxxxxxxxxxx> (Redacted sender "mike.ray" for DMARC)
  • To: raspberry-vi@xxxxxxxxxxxxx
  • Date: Sun, 23 Aug 2020 15:04:45 +0100

Hello,

As Chris has suggested, you can run a script from cron, and schedule it
to run at certain times and at certain frequencies.

For example you could run an update/upgrade script at 2 o'clock in the
morning once a week.

Google +"linux"+"cron"

Read up on how to add entries to the crontab.

And then run a script which looks something like this:

--snip--
#!/bin/bash

# make sure we are root
( EUID == 0 ) || { exit 1 ; }

apt-get update && apt-get upgrade

exit 0

--snip--

The line containing EUID checks the script is being run as root.

The "&&" between the update and the upgrade reads like "only run the
upgrade if the update worked"


You will need to add this to crontab as root:

sudo crontab -e


As I said, you will need to read up on how to add stuff to the crontab
entries.

crontab is a great way to schedule things to run, like run a backup in
the middle of the night.

Remember that in the crontab entry you will need to put the full path to
any script, because the run will not have your environment variables,
like $PATH, which usually make finding stuff easy.

Mike



On 23/08/2020 13:53, Flip wrote:

Hey Mike,

Trying to get three different pis (A 0,3 and 4)setup to update & 
upgrade without me having to log-in to them on a regular base.
Keep running across post talking about unattended-upgrades and don't 
really know anything about it.
seeing lots about having to change
the config for unattended-upgrades but not finding what needs to be changed,
and is this a safe program to have installed?
=========================================================== 
The raspberry-vi mailing list 
Archives: //www.freelists.org/archives/raspberry-vi
Administrative contact: <mike.ray@xxxxxxxxxxxxxx>
-----------------------------------------------------------
Raspberry Pi and the Raspberry Pi logo are trademarks of the Raspberry Pi 
Foundation.

This list is not affiliated to the Raspberry Pi Foundation and the views and 
attitudes expressed by the subscribers to this list do not reflect those of 
the Foundation.

Mike Ray, list creator, January 2013



-- 
Michael A. Ray
Analyst/Programmer
Witley, Surrey, South-east UK

"Perfection is achieved, not when there is nothing more to add, but when
there is nothing left to take away." -- A. de Saint-Exupery

https://cromarty.github.io/
http://eyesfreelinux.ninja/
http://www.raspberryvi.org/


=========================================================== 
The raspberry-vi mailing list 
Archives: //www.freelists.org/archives/raspberry-vi
Administrative contact: <mike.ray@xxxxxxxxxxxxxx>
-----------------------------------------------------------
Raspberry Pi and the Raspberry Pi logo are trademarks of the Raspberry Pi 
Foundation.

This list is not affiliated to the Raspberry Pi Foundation and the views and 
attitudes expressed by the subscribers to this list do not reflect those of the 
Foundation.

Mike Ray, list creator, January 2013

Other related posts: