Linux Useful

Automatic REBOOT if needed after apt-get upgrade – Linux

Sometimes after the execution of the apt-get upgrade command is finished, a restart is required, but this is not displayed after the command is completed, but you have to do it manually.

To do this, you need to check the existence of the /var/run/reboot-required file and then restart the system if the file exists.

To do this automatically, without the need for a manual check and run reboot command, you must use the apt (or apt-get) command as follows:

sudo apt-get -y upgrade; [ -e /var/run/reboot-required ] && sudo reboot

Leave a Reply

Your email address will not be published. Required fields are marked *