34 lines
1.1 KiB
Bash
Executable File
34 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
# Monitorink — redémarrage par TRIPLE-TAP (restaure Nickel / relance proprement).
|
|
# Lancé en arrière-plan par monitorink.sh (après que Nickel a été tué -> écran tactile libre).
|
|
# Utilise finger_trace (FBInk) pour détecter les touchers ; pas de mapping de coordonnées.
|
|
|
|
BASE="$(dirname "$0")"
|
|
cd "$BASE" || exit 1
|
|
LOG="$BASE/monitorink.log"
|
|
FT="./bin/fbink/finger_trace"
|
|
FBINK="./bin/fbink/fbink"
|
|
|
|
[ -x "$FT" ] || { echo "[watcher] finger_trace absent" >> "$LOG"; exit 0; }
|
|
echo "[watcher] triple-tap reboot actif" >> "$LOG"; sync
|
|
|
|
count=0
|
|
last=0
|
|
"$FT" 2>/dev/null | while read -r line; do
|
|
case "$line" in
|
|
*UP*|*RELEASE*|*Release*)
|
|
now=$(date +%s)
|
|
[ $((now - last)) -gt 3 ] && count=0
|
|
count=$((count + 1))
|
|
last=$now
|
|
echo "[watcher] tap $count/3" >> "$LOG"; sync
|
|
if [ "$count" -ge 3 ]; then
|
|
echo "[watcher] TRIPLE-TAP -> reboot" >> "$LOG"; sync
|
|
"$FBINK" -c -pmh "Redemarrage..." 2>/dev/null
|
|
sleep 1; sync
|
|
reboot
|
|
fi
|
|
;;
|
|
esac
|
|
done
|