Files
wevads-platform/scripts/brain-auto-cycle.sh
2026-02-26 04:53:11 +01:00

22 lines
814 B
Bash
Executable File

#!/bin/bash
# Brain Auto-Cycle: blacklist check + health + auto-provision
# Runs every 30 minutes
LOG="/var/log/wevads/brain-auto-cycle.log"
echo "$(date) - Brain Auto-Cycle starting" >> $LOG
# 1. Check all active server IPs for blacklists
curl -s 'http://127.0.0.1:5821/api/cloud_orchestrator.php?action=auto_cycle' >> $LOG 2>&1
# 2. Health check
curl -s 'http://127.0.0.1:5821/api/mta.php?action=health' >> $LOG 2>&1
# 3. Check specific IPs
for ip in $(PGPASSWORD=admin123 psql -U admin -d adx_system -t -c "SELECT main_ip FROM admin.mta_servers WHERE status='Activated'" 2>/dev/null); do
ip=$(echo $ip | tr -d ' ')
[ -z "$ip" ] && continue
curl -s "http://127.0.0.1:5821/api/cloud_orchestrator.php?action=blacklist_check&ip=$ip" >> $LOG 2>&1
done
echo "$(date) - Brain Auto-Cycle done" >> $LOG