server install: remove legacy reboot watchdog permanently
This commit is contained in:
parent
ea77734220
commit
84959406db
@ -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
|
|
||||||
@ -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
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Lesavka reboot watchdog timer
|
|
||||||
|
|
||||||
[Timer]
|
|
||||||
OnBootSec=15min
|
|
||||||
OnUnitActiveSec=15min
|
|
||||||
AccuracySec=30s
|
|
||||||
Persistent=true
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=timers.target
|
|
||||||
@ -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/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-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-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
|
sudo install -Dm755 "$SRC_DIR/scripts/daemon/lesavka-hw-watchdog.py" /usr/local/bin/lesavka-hw-watchdog.py
|
||||||
|
|
||||||
echo "==> 6a. Systemd units - lesavka-core"
|
echo "==> 6a. Systemd units - lesavka-core"
|
||||||
@ -258,33 +257,14 @@ EnvironmentFile=-/etc/lesavka/uvc.env
|
|||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
UNIT
|
UNIT
|
||||||
|
|
||||||
echo "==> 6d. Systemd units - watchdogs"
|
echo "==> 6d. Systemd units - remove legacy reboot watchdog"
|
||||||
cat <<'UNIT' | sudo tee /etc/systemd/system/lesavka-watchdog.service >/dev/null
|
sudo systemctl stop lesavka-watchdog.timer lesavka-watchdog.service >/dev/null 2>&1 || true
|
||||||
[Unit]
|
sudo systemctl disable lesavka-watchdog.timer lesavka-watchdog.service >/dev/null 2>&1 || true
|
||||||
Description=Lesavka reboot watchdog
|
sudo systemctl unmask lesavka-watchdog.timer lesavka-watchdog.service >/dev/null 2>&1 || true
|
||||||
ConditionPathExists=!/etc/lesavka/no-reboot
|
sudo rm -f /etc/systemd/system/lesavka-watchdog.timer \
|
||||||
|
/etc/systemd/system/lesavka-watchdog.service \
|
||||||
[Service]
|
/usr/local/bin/lesavka-watchdog.sh \
|
||||||
Type=oneshot
|
/etc/lesavka/watchdog.touch
|
||||||
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
|
|
||||||
|
|
||||||
cat <<'UNIT' | sudo tee /etc/systemd/system/lesavka-hw-watchdog.service >/dev/null
|
cat <<'UNIT' | sudo tee /etc/systemd/system/lesavka-hw-watchdog.service >/dev/null
|
||||||
[Unit]
|
[Unit]
|
||||||
@ -303,11 +283,9 @@ WantedBy=multi-user.target
|
|||||||
UNIT
|
UNIT
|
||||||
|
|
||||||
sudo install -d /etc/lesavka
|
sudo install -d /etc/lesavka
|
||||||
sudo touch /etc/lesavka/watchdog.touch
|
|
||||||
|
|
||||||
sudo systemctl daemon-reload
|
sudo systemctl daemon-reload
|
||||||
sudo systemctl enable --now lesavka-hw-watchdog
|
sudo systemctl enable --now lesavka-hw-watchdog
|
||||||
sudo systemctl enable --now lesavka-watchdog.timer
|
|
||||||
|
|
||||||
if systemctl is-active --quiet lesavka-uvc; then
|
if systemctl is-active --quiet lesavka-uvc; then
|
||||||
echo "✅ lesavka-uvc is active (dependency-managed; manual restart disabled)."
|
echo "✅ lesavka-uvc is active (dependency-managed; manual restart disabled)."
|
||||||
|
|||||||
@ -26,13 +26,6 @@ PATCH_DWC2_FIFO=${LESAVKA_KERNEL_PATCH_DWC2_FIFO:-}
|
|||||||
PATCH_UVC_BULK=${LESAVKA_KERNEL_PATCH_UVC_BULK:-}
|
PATCH_UVC_BULK=${LESAVKA_KERNEL_PATCH_UVC_BULK:-}
|
||||||
PATCH_UVC_DEBUG=${LESAVKA_KERNEL_PATCH_UVC_DEBUG:-}
|
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
|
if [[ -z $KERNEL_COMMIT ]]; then
|
||||||
KERNEL_COMMIT=$(git ls-remote "$KERNEL_REPO" "refs/heads/$KERNEL_BRANCH" | awk '{print $1}')
|
KERNEL_COMMIT=$(git ls-remote "$KERNEL_REPO" "refs/heads/$KERNEL_BRANCH" | awk '{print $1}')
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user