Wednesday, 25 October 2017

Alert: *** System restart required *** [ubuntu]

We must reboot our server when we install a new kernel or libraries, Ubuntu Linux can tell you if the system needs a reboot when you login as root user.

*** System restart required ***

The above warning will appear on the login screen, we may miss this warning. So here is the simple script for administrators to find exactly when the system requires reboot.

You can manually find the file: /var/run/reboot-required, which indicates System restart required.

Instead of a manual search, you can use below script to identify the ubuntu notification of 'system restart required’ at every login and never miss the warning.

Add the below lines in the file: /root/

if [ -f /var/run/reboot-required ]
   echo -e "\033[33;31m[*** Hello $USER, you must reboot your machine ***]\033[0m"
   echo -e "\033[33;32m\n*** System reboot is NOT required now ***\n`cat /var/lib/update-notifier/updates-available`\n\033[0m"

Now we can add the file path: /root/ in /root/.bashrc file to check 'whether the reboot required' task at every login made by root user.

# echo "/root/" >> /root/.bashrc && tail -n3 /root/.bash

Thanks !!

No comments:

Post a Comment