19 lines
622 B
Bash
Executable File
19 lines
622 B
Bash
Executable File
#!/bin/bash
|
|
# SMTP Monitor - Run every 4 hours
|
|
LOG_FILE="/var/log/smtp_monitor.log"
|
|
API_URL="http://localhost:5821/deliverads/api/smtp_monitor.php"
|
|
|
|
echo "$(date '+%Y-%m-%d %H:%M:%S') - Starting SMTP Health Check" >> $LOG_FILE
|
|
|
|
# Check all accounts
|
|
RESULT=$(curl -s "$API_URL?action=check_all")
|
|
echo "$(date '+%Y-%m-%d %H:%M:%S') - Check result: $RESULT" >> $LOG_FILE
|
|
|
|
# Get alerts
|
|
ALERTS=$(curl -s "$API_URL?action=alerts")
|
|
echo "$(date '+%Y-%m-%d %H:%M:%S') - Alerts: $ALERTS" >> $LOG_FILE
|
|
|
|
# TODO: Send alerts via email/slack if count > 0
|
|
|
|
echo "$(date '+%Y-%m-%d %H:%M:%S') - SMTP Health Check completed" >> $LOG_FILE
|