41 lines
681 B
Bash
Executable file
41 lines
681 B
Bash
Executable file
#!/bin/sh
|
|
|
|
. /lib/functions.sh
|
|
|
|
OVERLAY="$( grep ' /overlay ' /proc/mounts )"
|
|
|
|
case "$ACTION" in
|
|
pressed)
|
|
[ -z "$OVERLAY" ] && return 0
|
|
|
|
return 5
|
|
;;
|
|
timeout)
|
|
# . /etc/diag.sh
|
|
# set_state failsafe
|
|
# echo "REBOOT" > /dev/console
|
|
# sync
|
|
# reboot
|
|
|
|
killall /bin/heartbeat
|
|
killall /usr/sbin/openvpn
|
|
|
|
sleep 3
|
|
|
|
/bin/heartbeat &
|
|
;;
|
|
released)
|
|
if [ "$SEEN" -lt 1 ]
|
|
then
|
|
echo "PING" > /dev/console
|
|
ping -c4 10.8.0.1
|
|
elif [ "$SEEN" -ge 5 -a -n "$OVERLAY" ]
|
|
then
|
|
echo "REBOOT" > /dev/console
|
|
sync
|
|
reboot
|
|
fi
|
|
;;
|
|
esac
|
|
|
|
return 0
|