clean-shutdown icon indicating copy to clipboard operation
clean-shutdown copied to clipboard

Play Sound before Shutdown

Open marcOSS040 opened this issue 6 years ago • 1 comments

Is it possible to play a sound when the script is triggered to shut down the pi?

marcOSS040 avatar Dec 30 '18 13:12 marcOSS040

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.

Gadgetoid avatar Jan 18 '19 12:01 Gadgetoid