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
43 lines
1.2 KiB
Bash
Executable File
43 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# =========================================================
|
|
# RESTART ALL - Riavvio completo sistema IDS
|
|
# Usa systemctl per gestire tutti i servizi
|
|
# =========================================================
|
|
|
|
LOG_FILE="/var/log/ids/cron.log"
|
|
|
|
echo "$(date): === RESTART SETTIMANALE SISTEMA IDS ===" >> "$LOG_FILE"
|
|
|
|
# Stop all services via systemctl
|
|
echo "$(date): Arresto servizi..." >> "$LOG_FILE"
|
|
systemctl stop ids-ml-backend 2>/dev/null
|
|
systemctl stop ids-frontend 2>/dev/null
|
|
|
|
sleep 5
|
|
|
|
# Clean temp files
|
|
echo "$(date): Pulizia file temporanei..." >> "$LOG_FILE"
|
|
rm -f /var/log/ids/*.pid
|
|
find /tmp -name "ids_*" -mtime +7 -delete 2>/dev/null
|
|
|
|
# Restart services via systemctl
|
|
echo "$(date): Riavvio servizi..." >> "$LOG_FILE"
|
|
systemctl start ids-ml-backend
|
|
sleep 3
|
|
systemctl start ids-frontend
|
|
|
|
# Verify
|
|
if systemctl is-active --quiet ids-ml-backend; then
|
|
echo "$(date): ML Backend avviato con successo" >> "$LOG_FILE"
|
|
else
|
|
echo "$(date): ERRORE: ML Backend non si è avviato" >> "$LOG_FILE"
|
|
fi
|
|
|
|
if systemctl is-active --quiet ids-frontend; then
|
|
echo "$(date): Frontend avviato con successo" >> "$LOG_FILE"
|
|
else
|
|
echo "$(date): ERRORE: Frontend non si è avviato" >> "$LOG_FILE"
|
|
fi
|
|
|
|
echo "$(date): Restart completato!" >> "$LOG_FILE"
|