clean-shutdown
clean-shutdown copied to clipboard
Play Sound before Shutdown
Is it possible to play a sound when the script is triggered to shut down the pi?
This is supported natively by Linux (systemd) so you can just drop a script into /lib/systemd/system-shutdown/ and it will be run before shutdown/reboot. See: https://www.freedesktop.org/software/systemd/man/systemd-halt.service.html
If your script looks at the one argument its passed you can also check for halt, poweroff or reboot to see what's actually happening and react accordingly.