Python script to safely shutdown the RPi

Suggest new features here
Post Reply
G6WOV
Posts: 27
Joined: Thu May 13, 2021 12:47 pm

Python script to safely shutdown the RPi

Post by G6WOV »

Currently when you use the Dashboard Powerdown Command it Shutsdown Pi-Star but does not switch Off the Pi. There are ways to use a GPIO Pin to call a Python Script to Safely Shutdown the Pi. Can this Python Script be added to operate a Safe Shutdown when the Dashboard Powerdown Command is operated?
KE7FNS
Pi-Star Team
Posts: 1913
Joined: Wed Apr 17, 2019 11:11 pm

Re: Python script to safely shutdown the RPi

Post by KE7FNS »

G6WOV wrote: Wed Jun 16, 2021 9:24 pm Currently when you use the Dashboard Powerdown Command it Shutsdown Pi-Star but does not switch Off the Pi. There are ways to use a GPIO Pin to call a Python Script to Safely Shutdown the Pi. Can this Python Script be added to operate a Safe Shutdown when the Dashboard Powerdown Command is operated?
If I'm following what you are asking, I believe you are confusing a few things.

There are scripts that use a GPIO pin to detect when a button has been pressed and initiate a shutdown (in short when the button is triggered it runs "sudo poweroff"), but they do not cut power like a desktop computer. This is normal for all RPi's, they never cut the power.

There are add on boards that connect to the GPIO that supply power, and can cut power to the RPi by way of the GPIO. Like : https://shop.pimoroni.com/products/onoff-shim

The scripts that cut power are dependent on the add on hardware, so it would be best to just leave it up to the user to follow the instructions that came with their add on board.
If someones previous actions are any indication of their future actions, then I predict the deletion and removal of access will happen at any moment. 7-11-2020.

"07/13/20 This Website Has Been Taken Down" ... again :lol:
G6WOV
Posts: 27
Joined: Thu May 13, 2021 12:47 pm

Re: Python script to safely shutdown the RPi

Post by G6WOV »

Thank you for your reply, as I am new to Pi and Pi-star, I thought that the two would do the same. I noticed that the Pi does not actually Powerdown when the Dashboard Powerdown Command was operated, which has already been explained that only Pi-Star Shutsdown and leaves a message that it will stop in 30 seconds. Then I read elsewhere about the Pi having a Shutdown Function that could be triggered from a GPIO Pin. It just seemed a logical idea to me to combine the two, but use the script triggered from the Shutdown Command instead of a GPIO Pin. But if it had been that simple it would have been done already. I'm still learning :)
KE7FNS
Pi-Star Team
Posts: 1913
Joined: Wed Apr 17, 2019 11:11 pm

Re: Python script to safely shutdown the RPi

Post by KE7FNS »

G6WOV wrote: Wed Jun 16, 2021 10:25 pm But if it had been that simple it would have been done already. I'm still learning :)
Yeah, there just isn't a way that I'm aware of without the use of external add on boards.

Theres no harm in asking things.
If someones previous actions are any indication of their future actions, then I predict the deletion and removal of access will happen at any moment. 7-11-2020.

"07/13/20 This Website Has Been Taken Down" ... again :lol:
Post Reply