safeguard: check Docker/VM Manager enabled before acting

common.sh: add is_docker_enabled() and is_vm_manager_enabled() helpers
reading /boot/config/docker.cfg and /boot/config/domain.cfg.

docker_watchdog: exit cleanly if Docker not enabled in Unraid settings.
stability_watchdog: skip Docker daemon check and Docker container stop
if Docker not enabled; skip virsh VM shutdown if VM Manager not enabled.
server_reboot: skip VM shutdown and libvirt stop if VM Manager not enabled.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Gmer4Lfe
2026-05-31 15:18:58 -04:00
co-authored by Claude Sonnet 4.6
parent fdba23c32d
commit 46b27f609a
4 changed files with 35 additions and 6 deletions
+14
View File
@@ -719,6 +719,20 @@ check_rsync_enabled() {
return 0
}
# ==============================================================================================
# ── UNRAID SERVICE STATE ──────────────────────────────────────────────────────────────────────
# ==============================================================================================
# Reads Unraid config files to check whether Docker and VM Manager are enabled.
# Use these guards before any script that manages containers or VMs.
is_docker_enabled() {
[[ "$(grep -oP '(?<=DOCKER_ENABLED=")[^"]+' /boot/config/docker.cfg 2>/dev/null)" == "yes" ]]
}
is_vm_manager_enabled() {
[[ "$(grep -oP '(?<=SERVICE=")[^"]+' /boot/config/domain.cfg 2>/dev/null)" == "enable" ]]
}
# ==============================================================================================
# ── LOCAL HEALTH CHECKS ───────────────────────────────────────────────────────────────────────
# ==============================================================================================