1

I made a simple update script. Now My question was is it possible to run it automatically by loggin in on the Ubuntu Desktop and automatically provide my password (sudo) for this so I don't have to do anything to keep it updated.

This is my script:

#!/bin/bash

sudo apt-get update
sudo apt-get dist-upgrade -y

I would really be helped with this.

1 Answers1

0

You can add the script to run at start with:

sudo mv /sciptname /etc/init.d/
sudo chmod +x /etc/init.d/scriptname
sudo update-rc.d scriptname defaults 

I would edit the script:

#!/bin/bash
sudo apt-get update > /var/log/updatelog
sudo apt-get dist-upgrade -y >> /var/log/updatelog

Then the output goes to the file /var/log/updatelog, so you can look there if something is wrong.

However a better way would to use unattended-upgrades:

sudo apt-get install unattended-upgrades
sudo dpkg-reconfigure unattended-upgrades
Pabi
  • 7,401
  • 3
  • 40
  • 49