-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuttons
More file actions
20 lines (20 loc) · 709 Bytes
/
buttons
File metadata and controls
20 lines (20 loc) · 709 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
logger "the button was ${BUTTON} and the action was ${ACTION}"
if [ $BUTTON == "wps" ] ;
then
if [ $ACTION == "pressed" ] ;
then
echo $(date +%s) > /tmp/button.txt
logger "wps press time logged"
elif [ $ACTION == "released" ] ;
then
TIMECHECK=$(cat /tmp/button.txt)
DURATION=$(($(date +%s) - $TIMECHECK))
logger "wps release time logged"
logger "press duration was ${DURATION}"
if [ $DURATION -ge 10 ] ;
then
logger "[!!] 10s button hold, rebooting! [!!]"
reboot
fi
fi
fi