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/status.sh

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

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

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

Thanks !!

Comments

Popular posts from this blog

Resolved: DOCKER: Error response from daemon: Could not attach to network / rpc error: code = 7 desc = network not manually attachable.

yum failed 6 times. Cannot continue!

unexpectedly shrunk window (repaired) in dmesg log - TCP Peer