Create `ids-backend.service` for the Node.js backend, modify `check_frontend.sh` to use systemd, and update `install_systemd_services.sh` to include the new service. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 7a657272-55ba-4a79-9a2e-f1ed9bc7a528 Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Event-Id: 4484d762-7461-4e0f-bf71-fa7a7609e794 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/449cf7c4-c97a-45ae-8234-e5c5b8d6a84f/7a657272-55ba-4a79-9a2e-f1ed9bc7a528/6WuDAR4
24 lines
775 B
Bash
Executable File
24 lines
775 B
Bash
Executable File
#!/bin/bash
|
|
# =========================================================
|
|
# CHECK FRONTEND - Verifica se backend Node.js e' attivo
|
|
# =========================================================
|
|
|
|
LOG_FILE="/var/log/ids/backend.log"
|
|
|
|
mkdir -p /var/log/ids
|
|
|
|
if systemctl is-active --quiet ids-backend.service 2>/dev/null; then
|
|
exit 0
|
|
else
|
|
echo "[$(date)] Backend Node.js NON attivo" >> "$LOG_FILE"
|
|
systemctl start ids-backend.service 2>> "$LOG_FILE" || true
|
|
|
|
sleep 3
|
|
|
|
if systemctl is-active --quiet ids-backend.service 2>/dev/null; then
|
|
echo "[$(date)] Backend riavviato con successo via systemd" >> "$LOG_FILE"
|
|
else
|
|
echo "[$(date)] ERRORE: Backend non si e' avviato - verificare con: journalctl -u ids-backend -n 20" >> "$LOG_FILE"
|
|
fi
|
|
fi
|