Ubuntu – How does Ubuntu keep track of the “System restart required” flag in motd

Ubuntu

I have a few Ubuntu servers (8.10, 9.10) that is set to automatically install security updates. Some times these updates requires a restart of the system, and this string is shown in motd:

*** System restart required ***

To get a notice about these, I plan to write a Nagios test to monitor if the server is in need of a reboot. So, my question:

Is there a better way than parsing /etc/motd to find out if a reboot is needed?

Best Answer

Check for the presence of /var/run/reboot-required.