I would like to check if my computer with Ubuntu 14.04 was actively shutdown, or whether it crashed. I come into the office in the morning and my computer is off while it should have been on. This has happened a number of consecutive days, and I can check the computer goes off around the same time each night. So I want to know if my computer crashed or whether somebody shut it off. Is there a way to get this information from the logs?
Asked
Active
Viewed 3,723 times
2
-
Check `/var/log/syslog`, `last -x` – heemayl Oct 21 '15 at 07:55
-
Here are a few post: [How do I check if last shutdown was clean?](http://askubuntu.com/questions/103015/how-do-i-check-if-last-shutdown-was-clean) [Where is the shutdown log?](http://askubuntu.com/questions/58625/where-is-the-shutdown-log) – Remus Rigo Oct 21 '15 at 08:00
-
Thanks. I got what I needed from the logs and `last -x ` command. It seems my computer is crashing at night. – Niels Janssen Oct 21 '15 at 08:40
2 Answers
2
Find in /var/log a dmesg issue, command last to see the exact reboot time. You will see a line starting with reboot (or may be shutdown) for all reboot/crash.
cat /var/log/messages from a terminal and check for messages at the time stamp of reboot or just before it. dmesg can give the last boot time messages.
Jack Fosters
- 145
- 6
-
The last command is 'last reboot', which uses a special user 'reboot' for this command. – crafter Jun 16 '17 at 10:20
1
Issue the command
grep rsyslogd /var/log/syslog
or for less noise
grep -E 'rsyslogd.*(exit|start)'
If you see matched pairs of (blah blah)exit(blah blah) followed by (blah blah)start lines the system shutdown (at least somewhat) cleanly. If you have two (blah blah)start lines in a row the system did not shutdown cleanly.
SensorSmith
- 231
- 1
- 5