How to shut down Volumio when using Raspberry Pi with a Witty Pi 3 hat?

I usually shut down Volumio from the GUI. I’m guessing this shuts down the GUI, any non-GUI Volumio services and then runs the Linux command ‘shutdown’. I’m running Volumio on a Raspberry Pi and have just added a Witty Pi 3 Mini hat/board to provide a hardware on/off switch facility for the Pi. The Witty board has a push switch and a small controller which, when the switch is pressed, cleanly shuts down the Raspberry Pi and cuts the power to it (when the Witty is fitted the Pi gets its power via the Witty). As part of adding the Witty there are some shell scripts that are installed on the Pi(Volumio). One of these scripts (beforeShutdown.sh) is a “pre-shutdown” script which gets run before the Witty shuts down the Pi, and is the place for users to add their own shutdown commands. I’m guessing that I should add commands to this file to close the Volumio GUI and any Volumio specific services. So I’m looking for advice as to what command line commands I should add to “beforeShutdown.sh” to close the Volumio GUI and any Volumio specific services before the Witty does a standard/non-Volumio specific shutdown. Before you ask, I don’t know exactly what the Witty does/runs to shut down the Pi, but it won’t know the OS is Volumio rather than a standard Linux.

Regards,
Neil Mackie

I don’t believe you need to do anything specific to shutdown/close Volumio’s GUI and services judging by what Volumio does when you use the Shutdown button on the GUI.

Thanks for posting the code snippet. I agree, that looks like a standard shutdown, so there should be nothing that needs to be added to the Witty file. Thanks for your help.

You might want to add the call to sync to ensure any pending config files get written to disk…