Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4944

Advanced users • Re: Execute command at poweroff, not at reboot

$
0
0
I have something similar on this.
I want a python script to run before poweroff, halt and on

Code:

[Unit]Description=python script to run on all kinds of offBefore=poweroff.target shutdown.target reboot.target halt.target[Service]Type=oneshotUser=rootGroup=rootExecStart=/bin/trueExecStop=python3 /pathtoscript/script.pyRemainAfterExit=yes[Install]WantedBy=multi-user.target
it works in "bullseye" not in "bookworm".

owner of script is root/root mode 0644

Statistics: Posted by PieterG — Tue Feb 06, 2024 6:53 pm



Viewing all articles
Browse latest Browse all 4944

Trending Articles