Would this cause any risk to the system?
Yes. The same risk as with pulling the plug or turning it off at the wall: potential corruption of the attached SD card/drives.
Is there are better way to turn the Pi on and off as I like?
Depends. Do you want all power cut or are you happy with a small amount of current used (the same amount as when you sudo poweroff)?
If you're not using GPIO3 (physical pin 5) you can use that as both a shutdown and wake trigger:
- Connect a momentary push-to-make button/switch between that pin and any ground pin.
- Add the following to the end of your config.txt
Code:
[all]dtoverlay=gpio-shutdown - Reboot
Connecting power for the first time will continue to boot the Pi. If the Pi is booted, press and release the button for a safe shutdown. If its shutdown, press and release to boot.
You can use any free GPIO to trigger the shutdown (see /boot/firmware/overlays/README) but only GPIO3 can wake the Pi.
Statistics: Posted by thagrol — Sat Nov 01, 2025 11:48 pm