ids.alfacom.it/deployment/check_backend.sh
marco370 34d830b275 Replace custom scripts with systemd for managing backend and frontend services
Replace custom process management scripts (`check_backend.sh`, `check_frontend.sh`, `restart_all.sh`) with `systemctl` commands to ensure proper service management and virtual environment utilization.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7a657272-55ba-4a79-9a2e-f1ed9bc7a528
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: 9aa98b1a-1ee1-47f9-a579-83bad5992ed1
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/449cf7c4-c97a-45ae-8234-e5c5b8d6a84f/7a657272-55ba-4a79-9a2e-f1ed9bc7a528/MmMtYN7
2026-02-16 12:02:53 +00:00

29 lines
946 B
Bash
Executable File

#!/bin/bash
# =========================================================
# CHECK BACKEND - Verifica e riavvia backend Python se necessario
# Usa systemctl per gestire il servizio (con virtual environment)
# =========================================================
LOG_FILE="/var/log/ids/backend.log"
mkdir -p /var/log/ids
# Check if systemd service is active
if systemctl is-active --quiet ids-ml-backend; then
exit 0
else
echo "[$(date)] Backend Python NON attivo, riavvio via systemctl..." >> "$LOG_FILE"
# Restart via systemctl (usa il venv configurato nel service)
systemctl restart ids-ml-backend
# Wait for startup
sleep 3
if systemctl is-active --quiet ids-ml-backend; then
echo "[$(date)] Backend riavviato con successo via systemctl" >> "$LOG_FILE"
else
echo "[$(date)] ERRORE: Backend non si è avviato. Controlla: journalctl -u ids-ml-backend" >> "$LOG_FILE"
fi
fi