How does my sys admin know that I haven't rebooted my system?

I got an email from my system administrator saying that I needed to reboot my system to apply some patches. I had forgotten about it and after a couple of hours I got another mail telling me that I was yet to reboot my system.

I have since rebooted my system but I'm surprised how they'd know if I had rebooted my machine or not. Can someone explain how this works?


A quick way to check this remotely can be done using SNMP (provided your SysAdmin has set this up on your network):

admin@yourcompany:~$ snmpwalk -v 2c -c <snmpstring> MachineName sysUpTimeInstance
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (9461615) 1 day, 2:16:56.15

Most likely, the data would be polled and stored in a network management/monitoring system of some sort (i.e. Nagios or Cacti).

In case anyone is interested in playing around with the snmpwalk command, see the answer here to get a basic SNMP configuration set up on your system.


A simple method will be to check the output of the uptime command, which shows how long you have been running the system without a shutdown/restart.

Sample Output:

saji@geeklap:~$ uptime
12:41:29 up  3:08,  2 users,  load average: 1.06, 0.85, 0.86

It says that my system has been powered on for 3 hours and 8 minutes.

The admin can set up a shell script to either make use of uptime or to use some other method, as detailed in this link. Another method the admin can utilise is to setup an email to be send at system shutdown or restart, the details are available at this link.


@saji89 mentioned the uptime command. I'll go one step lower, and simply posit that the sysadmin has a script somewhere that connects to each computer and does a cat /proc/uptime (or something equivalent). The first field of the output is the time, in seconds, since the system was last rebooted, which is much easier to parse than the output of uptime. For example, my computer gives a first uptime field of 1441218.24 with uptime returning up 16 days, 16:20. 1441218 seconds is 16 days plus 58818 seconds, and 58818 seconds is 16 1/3 hours. 16 days 16 1/3 hours.

When you know the maximum length of time since the system should have been rebooted, this data makes it trivial to check to see if the system has been rebooted since then or not.

It could be done through a monitoring tool such as Nagios, or through a separate script that the sysadmin keeps on his computer (or rather accessible through it, I'd imagine) which connects to each computer in turn or in parallell and prints the time since last reboot in some format. That all depends on how elaborate to make it.


Another way, just for the sake of completeness, is to look at /var/log/wtmp via the last command. Example:

$ last reboot
reboot   system boot  3.2.0-36-generic Thu Jan 24 16:25 - 17:42 (1+01:17)   

wtmp begins Tue Jan  1 06:30:03 2013

This method is a favorite because it also happens to be the perfect mnemonic.

Q: When did the last reboot occur? 
A: Just type 'last reboot'