commit c953c777865238f76a1df2f13f3d14310115aa88 Author: adrian Date: Tue Dec 9 21:05:39 2025 -0300 Initial. diff --git a/module.prop b/module.prop new file mode 100644 index 0000000..968b548 --- /dev/null +++ b/module.prop @@ -0,0 +1,6 @@ +id=termux-watchdog +name=Termux Watchdog +version=1.0 +versionCode=1 +author=tenkuma +description=Reboots the device when the Termux app disappears. diff --git a/service.sh b/service.sh new file mode 100644 index 0000000..01fb343 --- /dev/null +++ b/service.sh @@ -0,0 +1,6 @@ +#!/system/bin/sh +# ------------------------------------------------- +# Magisk service script – starts the watchdog daemon +# ------------------------------------------------- + +nohup /system/bin/termux_watchdog >/dev/null 2>&1 & diff --git a/system/bin/termux_watchdog b/system/bin/termux_watchdog new file mode 100644 index 0000000..3179737 --- /dev/null +++ b/system/bin/termux_watchdog @@ -0,0 +1,24 @@ +#!/system/bin/sh +LOG="/data/local/tmp/termux_watchdog.log" +echo "$(date): Watchdog launched (PID=$)" >> "$LOG" + +# ---------- Wait for Termux ---------- +while true; do + TERMUX_PID=$(pidof -s com.termux) + if [ -n "$TERMUX_PID" ]; then + echo "$(date): Detected Termux (PID=$TERMUX_PID)" >> "$LOG" + break + fi + sleep 5 +done + +# ---------- Monitor ---------- +while true; do + TERMUX_PID=$(pidof -s com.termux) + if [ -z "$TERMUX_PID" ]; then + echo "$(date): Termux no longer running -> reboot" >> "$LOG" + reboot + break + fi + sleep 5 +done diff --git a/termux-watchdog.zip b/termux-watchdog.zip new file mode 100644 index 0000000..a2c7a41 Binary files /dev/null and b/termux-watchdog.zip differ