Code: Alles auswählen
#!/bin/sh -e
echo "Taste ca. 1 Sekunde drücken --> REBOOT"
echo "Taste ca. 7 Sekunden drücken --> POWEROFF"
# start beim booten: /usr/local/etc/rc.local
# ACHTUNG: den Aufruf in rc.local mit & abschliessen
# datei unter /usr/local/homeputer/safelogoff6.sh
gpio unexportall
# set mode to in and pullup GPIO26
PIN=26
gpio -g mode $PIN in
# gpio mode 26 up (up = pullup Widerstand)
HOLDTIME=4
TIME1=1
while [ 1=1 ]
# wait in interrupt for pin to go high (rising, falling, both)
gpio -g wfi 26 rising
do
# Got the high now poll to see if it stays low for holdtime
while [ `gpio -g read $PIN` -eq "1" ]
do
sleep 1
let TIME1+=1
done
if [ $TIME1 -gt $HOLDTIME ]; then
# if greater than holdtime then exit past done
HOLDTIME=6
break 3;
fi
if [ $TIME1 -le $HOLDTIME ]; then
# if less than holdtime then exit past done
HOLDTIME=5
break 3;
fi
continue
done
if [ $HOLDTIME -eq "5" ]; then
/sbin/reboot
fi
if [ $HOLDTIME -eq "6" ]; then
/sbin/poweroff
fi
exit 0
Code: Alles auswählen
#!/bin/sh -e
# rc.local
/usr/local/homeputer/safelogoff6.sh &
exit 0
Alle anderen Funktionen sind ok, nur eben kann ich keine Konfiguration mehr über die Konsole durchführen. Nehme ich das Script wieder aus der rc.local heraus, ist nach dem nächsten Start auch ein Konsolenzugang wieder möglich. Wie kann das sein???