Skip to content

Commit

Permalink
added poweroff
Browse files Browse the repository at this point in the history
  • Loading branch information
markyharris committed Mar 25, 2022
1 parent f1858d8 commit 253cad4
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
28 changes: 28 additions & 0 deletions poweroff info.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Power down script information
from; https://forums.raspberrypi.com/viewtopic.php?t=147422

Re: Poweroff script / systemd [solved]
Mon May 23, 2016 5:59 am

I have finally been able to run my poweroff program as late as possible during the shutdown process with the following poweroff.service
Code: Select all

[Unit]
Description=Turn power off after shutdown
DefaultDependencies=no
Before=umount.target

[Service]
Type=oneshot
ExecStart=/usr/bin/python /opt/my_poweroff/my_poweroff.py

[Install]
WantedBy=halt.target poweroff.target

Put this service into /lib/systemd/system, and a python script my_poweroff.py to be run at the end of the shutdown process into /opt/my_poweroff/my_poweroff.py

Enable the service with
Code: Select all

cd /lib/systemd/system
sudo systemctl enable poweroff.service
11 changes: 11 additions & 0 deletions poweroff.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=Turn power off after shutdown
DefaultDependencies=no
Before=umount.target

[Service]
Type=oneshot
ExecStart=/usr/bin/python /opt/metar_poweroff/metar_poweroff.py

[Install]
WantedBy=halt.target poweroff.target

0 comments on commit 253cad4

Please sign in to comment.