Raspberry Pi Shutdown Button?

I’m running (basic) IPFire functionality on a Pi 3B+. It has worked very well for me. However, there are times when I’m doing maintenance that I end up in a bad place from a networking perspective and really need to shut my Pi down cleanly. The fact that I can’t get to the web services means I end up cutting power, which is always dangerous with these devices. Has anyone set up an external switch that can be used to initiate a shutdown/restart? I’ve done this on normal Raspian for another device, but wondering how that would/would not work with IPFire?


Haven’t checked this, but I presume a reboot command would gracefully restart the appliance. This can be done pretty easily with Python, just add a GPIO listener.

Shutdown would presumably work the same, however shutdown now doesn’t seem to power the machine off. As said, never looked into this, so it’s purely theoretical :wink:

You can create a cronjob, service or use another form of autostart I guess.

Thanks. Would that survive core updates without any issues?

Yes it will. Core Updates replace IPFire packages with updated ones so editing those packages risks update replacing them.

The simplest is to create a directory for your scripts and place that script in there. You can then add that directory to


This will then add the contents of that directory to any backup that is carried out on IPFire so your script will also be saved.

There is no Power off on the RPi. You can do a shutdown command and it will stop Linux running but the power will stay on. The only way to turn off the power is to pull out the power plug.
If you run the shutdown command you will need to watch on the serial console one time to note how long it takes so that in future you know when the shutdown command is likely to have completed.


Sounds great. Thanks!