User Tools

Site Tools


shutdown

If you want to send us your comments, please do so. Thanks
More on comments


Shutdown

In systemd the shutdown command does not work anymore. It has been made more complicated. See Systemd halt service. Use

systemd-poweroff.service

Log files

In these logfiles maybe you can find a clue about the shutdown reason

/var/log/boot
/var/log/debug
/var/log/kern.log
/var/log/messages
/var/log/syslog
/var/log/user.log

Show shutdown time

The shutdown time and reason, if there was no crash or freeze, can be found in

  • /var/log/auth.log (search for “System is powering down”)
  • /var/log/syslog (search for “Stopping Light Display Manager”)

reasons might also be other reasons
A list of shutdown times can be generated with

last -x shutdown

An example entry

shutdown system down  4.19.0-9-amd64   Thu Jul 30 16:22 - 20:11  (03:49)

This means the system was in shutdown state (off) from Jul 30 16:22 until Jul 30 20:11 which is during 03:49 hours

Show up time

A list of system running times can be generated with

last -x reboot

An example entry

reboot   system boot  4.19.0-9-amd64   Tue Jun 19 19:24 - 13:47 (18+18:23)

This means the system was booted on and up (running) from Jun 19 19:24 until Jul 8 13:47 which is during 18 days and 18:23 hours

Log shutdown

Create a file named $HOME/shutdownlogging.service containing

[Unit]
Description=Create a log entry in $HOME/shutdown.log when the computer is shutdown by the user

[Service]
Type=oneshot
RemainAfterExit=true
ExecStop=echo $(date;echo "Shutdown") >> $HOME/shutdown.log

[Install]
WantedBy=multi-user.target

Run

systemctl daemon-reload
systemctl enable $HOME/shutdownlogging.service --now

How to run a script with systemd right before shutdown
How to find out from the logs what caused system shutdown


Main subjects on this wiki: Linux, Debian, HTML, Microcontrollers, Privacy

RSS
Disclaimer
Privacy statement
Bugs statement
Cookies
Copyright © : 2014 - 2024 Webevaluation.nl and the authors
Changes reserved.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
shutdown.txt · Last modified: 02-08-2020 19:24 by wim