]> git.gir.st - hardpass.git/blame_incremental - shutdown/shutdown-button.sh
re-done pcb for 30 pin oled
[hardpass.git] / shutdown / shutdown-button.sh
... / ...
CommitLineData
1#!/bin/bash
2
3# monitor GPIO pin 17 for shutdown signal
4
5# export GPIO pin 17 and set to input with pull-up
6echo "17" > /sys/class/gpio/export
7echo "in" > /sys/class/gpio/gpio17/direction
8echo "high" > /sys/class/gpio/gpio17/direction
9
10# wait for pin to go low
11while [ true ]
12do
13if [ "$(cat /sys/class/gpio/gpio17/value)" == '0' ]
14then
15 echo "Raspberry Pi Shutting Down!"
16 #halt &
17 shutdown -h now
18 exit 0
19fi
20sleep 1
21done
Imprint / Impressum