Determine when Linux lost power

3

I returned from a trip and noticed that my apartment had lost power. I am currently running a small Linux server (Ubuntu 8.04) and had to boot it back up.

Is there a way to read some log and see when it lost power?

Using last only shows when I booted it back up.

Colby Olson

Posted 2011-12-29T03:17:33.657

Reputation: 33

Answers

3

Check /var/log or /usr/var/log (dont know exactly where your distro stores this file but it should be one of those two) and look for any abrupt change between the time stamps or find the first occurrences of entries close to the output of the last command.

Icarus

Posted 2011-12-29T03:17:33.657

Reputation: 539

0

Check last | grep reboot. This will show you a list of boot times. On my Ubuntu 11.04 installation, this produces lines like:

reboot   system boot  2.6.38-13-generi Wed Dec 28 12:42 - 15:37 (1+02:55)
reboot   system boot  2.6.38-13-generi Tue Dec 27 07:33 - 15:37 (2+08:03)
reboot   system boot  2.6.38-13-generi Sat Dec 24 14:43 - 23:14 (2+08:31)
reboot   system boot  2.6.38-13-generi Fri Dec 23 11:07 - 16:29  (05:22)
reboot   system boot  2.6.38-13-generi Thu Dec 22 21:05 - 16:29  (19:23)

These mean that my system is up for

  • 1 day, 2 hours, 55 minutes
  • 2 days, 8 hours, 3 minutes
  • 2 days, 8 hours, 31 minutes
  • 5 hours 22 minutes
  • 19 hours 23 minutes

Hopefully Ubuntu 8.04 has the same feature.

Kevin M

Posted 2011-12-29T03:17:33.657

Reputation: 2 396