Recreados todos los scripts
This commit is contained in:
21
button_control.sh
Executable file
21
button_control.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
source /opt/raspberry_scripts/led_config.conf
|
||||
|
||||
while true; do
|
||||
gpiomon --num-events=1 --rising $CHIP $BTN_LINE > /dev/null
|
||||
|
||||
START_TIME=$(date +%s)
|
||||
|
||||
while [ $(gpioget $CHIP $BTN_LINE) -eq 1 ]; do
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
END_TIME=$(date +%s)
|
||||
DURATION=$((END_TIME - START_TIME))
|
||||
|
||||
if [ $DURATION -ge 5 ]; then
|
||||
reboot
|
||||
elif [ $DURATION -ge 0 ]; then
|
||||
poweroff
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user