Skip to content

Commit b65de8e

Browse files
committed
shutdown button
1 parent 9949af8 commit b65de8e

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

shutdown_button.sh

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
# Raspberry Pi Linux Workshop
4+
# Fablab Palermo 03/12/2016
5+
# Bash script per spegnere la raspberry premendo un bottone
6+
7+
#Attiviamo il GPIO
8+
gpio mode 1 input
9+
gpio mode 1 up
10+
11+
# Creiamo una funziona per lo shutdown
12+
function shutdown {
13+
sudo poweroff
14+
}
15+
16+
# Now wait!
17+
while :
18+
do
19+
if [ $(gpio read 1) = 1 ]; then
20+
echo "button pressed! system shutdown"
21+
shutdown
22+
else
23+
wait
24+
fi
25+
done

0 commit comments

Comments
 (0)