Skip to content

Commit

Permalink
Describe service in README
Browse files Browse the repository at this point in the history
  • Loading branch information
oreinert committed Apr 2, 2018
1 parent 5e7be4f commit 1f45766
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,33 @@
# dirtyboot
Detect and log Linux reboot without clean shutdown

Detect and log Linux boot not preceded by a clean shutdown.

## Mechanism

A systemd service, started early in the boot process, writes a marker file
(`/var/lib/dirtyboot` by default). When the service is stopped, during system
shutdown, the marker file is removed.

Thus, if the marker file is already present the next time the service starts,
it means the system wasn't shut down cleanly before rebooting. Whenever this
condition occurs, the service writes a corresponding warning to the system log.

## Inspecting dirty reboot warnings

Run the command

journalctl -t dirtyboot

## Installation

Put the systemd unit file in `/etc/systemd/system`, and the shell script to
`/usr/sbin/dirtyboot`. Then enable the service using

systemctl enable dirtyboot

## Motivation

I had an unstable system which tended to hang after long periods of idling.
This simple tool was used to keep track of the number of hard resets I had to
do to restore operation of a hung system. Since system log entries are
timestamped, it also records the time interval between such hard resets.

0 comments on commit 1f45766

Please sign in to comment.