Safety Shutdown by a Reset Button

Here is all the tutorials, FAQ and support for RaspiBoy Kit
Post Reply
liolabs1973
Posts: 1
Joined: Thu 6 Jul 2017 15:33

Safety Shutdown by a Reset Button

Post by liolabs1973 »

Hi,

Here is a small shell script who's can be include in the Raspiboy to perform a safety shutdown

Have fun...
Lionel

#!/bin/bash

setup ()
{
echo Setup
gpio mode 2 in ; // si biensur le pin 2 est dispo
}
setup
while :
do
result=`gpio read 2`
if [ $result -eq 0 ]; then
echo BUTTONPRESSED /dev/null sudo init
6 // qui execute un soft-reset en démontant proprement le file system

fi
sleep 0.1
done
pbhound
Posts: 7
Joined: Mon 14 Aug 2017 03:23

Re: Safety Shutdown by a Reset Button

Post by pbhound »

liolabs1973 wrote:Hi,

Here is a small shell script who's can be include in the Raspiboy to perform a safety shutdown

Have fun...
Lionel

#!/bin/bash

setup ()
{
echo Setup
gpio mode 2 in ; // si biensur le pin 2 est dispo
}
setup
while :
do
result=`gpio read 2`
if [ $result -eq 0 ]; then
echo BUTTONPRESSED /dev/null sudo init
6 // qui execute un soft-reset en démontant proprement le file system

fi
sleep 0.1
done
thank you i will just need to translate this to english-us and it will work fine i think.
thexter
Posts: 5
Joined: Thu 24 Aug 2017 16:07

Re: Safety Shutdown by a Reset Button

Post by thexter »

Please provide instruction on how to add this script?
chris_jh
Posts: 3
Joined: Fri 25 Aug 2017 14:31

Re: Safety Shutdown by a Reset Button

Post by chris_jh »

This script may work, but you will not be able to copy and paste it as the formatting is not quite right.
liolabs1973 you needed to use the Code button when posting.

Also it will require wiring up and install a physical button to the RaspiBoy, to pin 2 and ground i think.

If you want to do this, rather than Pressing Start, Selecting Quit and Shutdown.

Then may i suggest you following this guide.

https://www.hackster.io/masteruan/raspb ... ton-576c74

But again it will require modification to the RaspiBoy.

Do at your own risk, i take no responsibility.
Post Reply