Just how can I inform, from the command line, whether the equipment calls for a reboot?
When you install particular updates (e.g. a new bit) in Ubuntu Desktop, you get a sign that a reboot is called for (in Lucid, the logout symbol reddens).
Just how can I examine, from the command line, whether an Ubuntu web server calls for a reboot?
I can grep for 'System reactivate called for' in
/etc/motd, yet I would certainly such as a remedy that's even more classy. Additionally, I desire a remedy that operates in older launches, e.g. Hardy (8.04 LTS).
Aswell as one of the most straight approaches created by others there is a convenient sign if you make use of byobu - a set of manuscripts to make GNU screen a little bit even more easy to use. It reveals a set of details at the end of the screen, which can include whether a reboot is called for - in addition to whether updates are readily available, the moment, uptime, memory made use of ...
In this screenshot you can see from the
199! under line with the red history that there are 199 updates readily available, and also the
! suggests that some are protection updates. The food selection in the foreground is picking which standing alerts need to be presented.
If a reboot is called for after that this will certainly be shown by the icon
(R) presented in the lower bar with white message on a blue history. Even more information and also various other indications can be reviewed in the byobu man page.
You can merely examine if the documents
/var/run/reboot-required exists or otherwise.
As an example, any one of these would certainly inform you "no such documents" or "documents not located" if you do not require to reboot, or else (if you require to reboot) the documents would certainly exist and also these commands would certainly show details concerning the documents:
file /var/run/reboot-required stat /var/run/reboot-required ls /var/run/reboot-required
In a celebration manuscript, you can make use of:
#!/bin/bash if [ -f /var/run/reboot-required ]; then echo 'reboot required' fi