diff --git a/birdnet-pi/rootfs/custom-services.d/30-monitoring.sh b/birdnet-pi/rootfs/custom-services.d/30-monitoring.sh index 17fa7a0ac6..5b31470219 100755 --- a/birdnet-pi/rootfs/custom-services.d/30-monitoring.sh +++ b/birdnet-pi/rootfs/custom-services.d/30-monitoring.sh @@ -90,8 +90,8 @@ while true; do # Check service states for service in "$srv" "$srv2"; do - state_var="${service}_state" - if [[ "${state_var:-}" != "active" ]]; then + state="$(systemctl is-active "$service")" + if [[ "$state" != "active" ]]; then log_yellow "$(date) INFO: Restarting $service service" sudo systemctl restart "$service" fi