From 84959406dbd93c1c83a4fb3d157600960456f057 Mon Sep 17 00:00:00 2001 From: Brad Stein Date: Thu, 9 Apr 2026 12:32:37 -0300 Subject: [PATCH] server install: remove legacy reboot watchdog permanently --- scripts/daemon/lesavka-watchdog.service | 10 ------- scripts/daemon/lesavka-watchdog.sh | 23 --------------- scripts/daemon/lesavka-watchdog.timer | 11 ------- scripts/install/server.sh | 38 ++++++------------------- scripts/kernel/build-linux-rpi.sh | 7 ----- 5 files changed, 8 insertions(+), 81 deletions(-) delete mode 100644 scripts/daemon/lesavka-watchdog.service delete mode 100644 scripts/daemon/lesavka-watchdog.sh delete mode 100644 scripts/daemon/lesavka-watchdog.timer diff --git a/scripts/daemon/lesavka-watchdog.service b/scripts/daemon/lesavka-watchdog.service deleted file mode 100644 index 670e35e..0000000 --- a/scripts/daemon/lesavka-watchdog.service +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=Lesavka reboot watchdog -ConditionPathExists=!/etc/lesavka/no-reboot - -[Service] -Type=oneshot -ExecStart=/usr/local/bin/lesavka-watchdog.sh - -[Install] -WantedBy=multi-user.target diff --git a/scripts/daemon/lesavka-watchdog.sh b/scripts/daemon/lesavka-watchdog.sh deleted file mode 100644 index 27b2ba5..0000000 --- a/scripts/daemon/lesavka-watchdog.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -HEARTBEAT=/etc/lesavka/watchdog.touch -MAX_AGE_SEC=${LESAVKA_WATCHDOG_MAX_AGE:-840} - -if [[ -f /etc/lesavka/no-reboot ]]; then - exit 0 -fi - -now=$(date +%s) -if [[ ! -f "$HEARTBEAT" ]]; then - logger -t lesavka-watchdog "no heartbeat file; rebooting" - systemctl --no-wall reboot - exit 0 -fi - -mtime=$(stat -c %Y "$HEARTBEAT" 2>/dev/null || echo 0) -age=$((now - mtime)) -if (( age > MAX_AGE_SEC )); then - logger -t lesavka-watchdog "heartbeat stale (${age}s); rebooting" - systemctl --no-wall reboot -fi diff --git a/scripts/daemon/lesavka-watchdog.timer b/scripts/daemon/lesavka-watchdog.timer deleted file mode 100644 index 12ed398..0000000 --- a/scripts/daemon/lesavka-watchdog.timer +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Lesavka reboot watchdog timer - -[Timer] -OnBootSec=15min -OnUnitActiveSec=15min -AccuracySec=30s -Persistent=true - -[Install] -WantedBy=timers.target diff --git a/scripts/install/server.sh b/scripts/install/server.sh index e3e039b..c991ca5 100755 --- a/scripts/install/server.sh +++ b/scripts/install/server.sh @@ -164,7 +164,6 @@ sudo install -Dm755 "$SRC_DIR/server/target/release/lesavka-server" /usr/local/b sudo install -Dm755 "$SRC_DIR/server/target/release/lesavka-uvc" /usr/local/bin/lesavka-uvc sudo install -Dm755 "$SRC_DIR/scripts/daemon/lesavka-core.sh" /usr/local/bin/lesavka-core.sh sudo install -Dm755 "$SRC_DIR/scripts/daemon/lesavka-uvc.sh" /usr/local/bin/lesavka-uvc.sh -sudo install -Dm755 "$SRC_DIR/scripts/daemon/lesavka-watchdog.sh" /usr/local/bin/lesavka-watchdog.sh sudo install -Dm755 "$SRC_DIR/scripts/daemon/lesavka-hw-watchdog.py" /usr/local/bin/lesavka-hw-watchdog.py echo "==> 6a. Systemd units - lesavka-core" @@ -258,33 +257,14 @@ EnvironmentFile=-/etc/lesavka/uvc.env WantedBy=multi-user.target UNIT -echo "==> 6d. Systemd units - watchdogs" -cat <<'UNIT' | sudo tee /etc/systemd/system/lesavka-watchdog.service >/dev/null -[Unit] -Description=Lesavka reboot watchdog -ConditionPathExists=!/etc/lesavka/no-reboot - -[Service] -Type=oneshot -ExecStart=/usr/local/bin/lesavka-watchdog.sh - -[Install] -WantedBy=multi-user.target -UNIT - -cat <<'UNIT' | sudo tee /etc/systemd/system/lesavka-watchdog.timer >/dev/null -[Unit] -Description=Lesavka reboot watchdog timer - -[Timer] -OnBootSec=15min -OnUnitActiveSec=15min -AccuracySec=30s -Persistent=true - -[Install] -WantedBy=timers.target -UNIT +echo "==> 6d. Systemd units - remove legacy reboot watchdog" +sudo systemctl stop lesavka-watchdog.timer lesavka-watchdog.service >/dev/null 2>&1 || true +sudo systemctl disable lesavka-watchdog.timer lesavka-watchdog.service >/dev/null 2>&1 || true +sudo systemctl unmask lesavka-watchdog.timer lesavka-watchdog.service >/dev/null 2>&1 || true +sudo rm -f /etc/systemd/system/lesavka-watchdog.timer \ + /etc/systemd/system/lesavka-watchdog.service \ + /usr/local/bin/lesavka-watchdog.sh \ + /etc/lesavka/watchdog.touch cat <<'UNIT' | sudo tee /etc/systemd/system/lesavka-hw-watchdog.service >/dev/null [Unit] @@ -303,11 +283,9 @@ WantedBy=multi-user.target UNIT sudo install -d /etc/lesavka -sudo touch /etc/lesavka/watchdog.touch sudo systemctl daemon-reload sudo systemctl enable --now lesavka-hw-watchdog -sudo systemctl enable --now lesavka-watchdog.timer if systemctl is-active --quiet lesavka-uvc; then echo "✅ lesavka-uvc is active (dependency-managed; manual restart disabled)." diff --git a/scripts/kernel/build-linux-rpi.sh b/scripts/kernel/build-linux-rpi.sh index 5bd17e1..0b64695 100644 --- a/scripts/kernel/build-linux-rpi.sh +++ b/scripts/kernel/build-linux-rpi.sh @@ -26,13 +26,6 @@ PATCH_DWC2_FIFO=${LESAVKA_KERNEL_PATCH_DWC2_FIFO:-} PATCH_UVC_BULK=${LESAVKA_KERNEL_PATCH_UVC_BULK:-} PATCH_UVC_DEBUG=${LESAVKA_KERNEL_PATCH_UVC_DEBUG:-} -HEARTBEAT=/etc/lesavka/watchdog.touch -if [[ -w $HEARTBEAT && -z ${LESAVKA_DISABLE_KEEPALIVE:-} ]]; then - (while true; do touch "$HEARTBEAT"; sleep 600; done) & - KEEPALIVE_PID=$! - trap 'kill $KEEPALIVE_PID' EXIT -fi - if [[ -z $KERNEL_COMMIT ]]; then KERNEL_COMMIT=$(git ls-remote "$KERNEL_REPO" "refs/heads/$KERNEL_BRANCH" | awk '{print $1}') fi