Wednesday, May 22, 2024

set up your Raspberry Pi to automatically update and upgrade after every reboot

 To set up your Raspberry Pi to automatically update and upgrade its software

 after every reboot, you can use a combination of 

shell scripting and cron jobs. Here's a step-by-step guide:

------------------------------------------------------------------------------------

sudo nano /usr/local/bin/auto-update-upgrade.sh


#!/bin/bash

{

  echo "Starting update and upgrade: $(date)"

  echo "Waiting for network to stabilize..."

  sleep 120  # Delay for 120 seconds to allow the network to stabilize

  sudo apt-get update -y

  sudo apt-get upgrade -y

  echo "Update and upgrade completed: $(date)"

} >> /var/log/auto-update-upgrade.log 2>&1

---------------------------------------------------------------------------------------------

sudo chmod +x /usr/local/bin/auto-update-upgrade.sh

---------------------------------------------------------------------------------------------

Set Up a Cron Job to Run the Script on Reboot


sudo crontab -e


0 3 * * * /sbin/reboot

@reboot /usr/local/bin/auto-update-upgrade.sh

--------------------------------------------------------------------------------------------

sudo reboot

--------------------------------------------------------------------------------------------

Check the Log File

cat /var/log/auto-update-upgrade.log

-------------------------------------------------------------------------------------------

Semoga bermanfaat, 73

Setup KA9Q-Radio radiosonde_auto_rx airspy mini

                             Setup KA9Q-Radio + radiosonde_auto_rx  (Airspy mini + Raspberry Pi + Docker) 1. Objektif Setup Manual ini bertu...