Harden API uptime with systemd ownership guard and watchdog
This commit is contained in:
parent
ab6ad85db7
commit
b089dc1639
10 changed files with 93 additions and 7 deletions
10
deploy/scripts/staysense-watchdog.sh
Executable file
10
deploy/scripts/staysense-watchdog.sh
Executable file
|
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
HEALTH_URL="${HEALTH_URL:-http://127.0.0.1:8787/health}"
|
||||
TIMEOUT_SECONDS="${TIMEOUT_SECONDS:-5}"
|
||||
|
||||
if ! curl -fsS --max-time "${TIMEOUT_SECONDS}" "${HEALTH_URL}" >/dev/null; then
|
||||
logger -t staysense-watchdog "healthcheck failed for ${HEALTH_URL}, restarting staysense-api.service"
|
||||
systemctl restart staysense-api.service
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue