server install: remove legacy reboot watchdog permanently

This commit is contained in:
Brad Stein 2026-04-09 12:32:37 -03:00
parent ea77734220
commit 84959406db
5 changed files with 8 additions and 81 deletions

View File

@ -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

View File

@ -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

View File

@ -1,11 +0,0 @@
[Unit]
Description=Lesavka reboot watchdog timer
[Timer]
OnBootSec=15min
OnUnitActiveSec=15min
AccuracySec=30s
Persistent=true
[Install]
WantedBy=timers.target

View File

@ -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)."

View File

@ -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