Uptime at shutdown

Why do you care so much about uptime? The datetime stamps in /var/log/messages will tell you when the system started shutting down, assuming it does a 'proper' shutdown, not an instant off kind of thing.
 
Why do you care so much about uptime? The datetime stamps in /var/log/messages will tell you when the system started shutting down, assuming it does a 'proper' shutdown, not an instant off kind of thing.
I want to know how long the system will last on a full battery.
 
It's easy enough to figure out when the system booted (that's in the log), and when it shut down. Either the shutdown is in the log, or regular log updates from other subsystems stop happening. Then calculate the difference yourself.
 
It's easy enough to figure out when the system booted (that's in the log), and when it shut down. Either the shutdown is in the log, or regular log updates from other subsystems stop happening. Then calculate the difference yourself.
Does dmesg record the time of a shutdown when a system shuts down when it runs out of power?
 
There are probably some ACPI battery signals that throw a message at XX amount of time before battery depletion.
But realistically with no power there is no log entry written.

But it depends on signals received. In some cases the computer may be shutdown by ACPI signals and other case just run to death.

 
sysutils/tuptime
Not quite what you're after but does report number of startups/shut downs, system life etc
> tuptime
System startups: 111 since 15:22:20 28/06/2025

System shutdowns: 98 ok + 12 bad
System life: 354d 4h 11m 44s

Longest uptime: 14d 12h 7m 38s from 22:34:36 16/09/2025
Average uptime: 1d 22h 24m 54s
System uptime: 60.61% = 214d 16h 4m 34s

Longest downtime: 42d 5h 21m 34s from 12:13:32 14/02/2026
Average downtime: 1d 6h 26m 15s
System downtime: 39.39% = 139d 12h 7m 10s

Current uptime: 9h 40m 42s since 09:53:22 17/06/2026
 
Back
Top