refactor: update dependencies and remove unused code
- Added new dependencies: `adler2`, `crc32fast`, `flate2`, `miniz_oxide`, and `libredox`. - Updated existing dependencies: `tokio-rustls` to version 0.26.4 and `filetime` to version 0.2.27. - Removed the `backup.rs` file as it is no longer needed. - Introduced tests for configuration and credential management. - Enhanced the `identity` module to generate W3C compliant DID documents. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
fd2a837bea
commit
f07ce10b1a
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
# kiosk-watchdog.sh — Monitors Archipelago backend health.
|
||||
# Restarts the backend if it's unresponsive for 60 seconds.
|
||||
# Shows server IP on text console if X is not running.
|
||||
#
|
||||
# Designed to run as a systemd service or standalone.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
HEALTH_URL="http://localhost/health"
|
||||
CHECK_INTERVAL=5 # seconds between checks
|
||||
MAX_FAILS=12 # 12 x 5s = 60s before restart
|
||||
|
||||
FAIL_COUNT=0
|
||||
|
||||
echo "Archipelago kiosk watchdog started"
|
||||
|
||||
while true; do
|
||||
# Check backend health
|
||||
if curl -sf "$HEALTH_URL" > /dev/null 2>&1; then
|
||||
if [ "$FAIL_COUNT" -gt 0 ]; then
|
||||
echo "Backend recovered after $FAIL_COUNT failed checks"
|
||||
fi
|
||||
FAIL_COUNT=0
|
||||
else
|
||||
FAIL_COUNT=$((FAIL_COUNT + 1))
|
||||
echo "Health check failed ($FAIL_COUNT/$MAX_FAILS)"
|
||||
|
||||
if [ "$FAIL_COUNT" -ge "$MAX_FAILS" ]; then
|
||||
echo "Backend unresponsive for 60s, restarting archipelago service..."
|
||||
systemctl restart archipelago || true
|
||||
FAIL_COUNT=0
|
||||
sleep 10
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
# If X is not running, display IP on text console as fallback
|
||||
if ! pgrep -x Xorg > /dev/null 2>&1 && ! pgrep -x chromium > /dev/null 2>&1; then
|
||||
IP=$(hostname -I 2>/dev/null | awk '{print $1}')
|
||||
if [ -n "$IP" ]; then
|
||||
printf '\n\n Archipelago Server\n IP: %s\n Web UI: http://%s\n\n' "$IP" "$IP" > /dev/tty1 2>/dev/null || true
|
||||
fi
|
||||
fi
|
||||
|
||||
sleep "$CHECK_INTERVAL"
|
||||
done
|
||||
Reference in New Issue
Block a user