[Unit]
Description=IDS ML Hybrid Detector Training
Documentation=https://github.com/your-repo/ids
After=network.target postgresql.service
Requires=postgresql.service

[Service]
Type=oneshot
User=root
WorkingDirectory=/opt/ids/python_ml

# Carica environment file per credenziali database
EnvironmentFile=/opt/ids/.env

# Esegui training
ExecStart=/opt/ids/deployment/run_ml_training.sh

# Timeout generoso (training può richiedere fino a 30 min)
TimeoutStartSec=1800

# Log
StandardOutput=journal
StandardError=journal
SyslogIdentifier=ids-ml-training

# Restart policy
Restart=no

[Install]
WantedBy=multi-user.target
