Raspberry Pi Pushbutton Shutdown/Startup
The attached script will install shutdown and startup capability using a SPST NO momentary pushbutton
switch connected to GPIO header pins 5 and 6. Pressing the button on a running system will initiate
a graceful shutdown (shutdown -h now). Once shut down, pressing the button will restart the system.
1. Copy install and gpio-shutdown.dtbo to the Raspberry Pi.
2. Make the install script executable:
$ chmod +x install
3. Run the install script:
$ sudo ./install
For additional info, see:
The script can be downloaded from RonR’s original post or directly from https://www.dslreports.com/r0/download/2324182~6a03744946c51bfa4876b6ecd8d4528c/PushButton.zip