how about one at a time. or identify which is triggered “every 30 seconds to a minute” or have you added a cron job beyond the standard.
If it is a cron job then is there a timed email stuck in the queue?
There is no mail in the root mailbox when I check.
I’m guessing this log is some sort of internal processing going on.
Seems to be caused by a script I created to check the mail.log and have running every minute under cron. It checks if too many emails are sent within a minute. I don’t see how this would be causing these lines in the log as per my first post. Any ideas?
#!/bin/bash
# Set the threshold for the number of emails in the last minute
THRESHOLD=5
# Log file for postfix
LOG_FILE="/var/log/mail.log"
# Calculate the timestamp for one minute ago
ONE_MINUTE_AGO=$(date -d '1 minute ago' '+%b %e %H:%M')
# Count the number of emails in the last minute
EMAIL_COUNT=$(grep "$ONE_MINUTE_AGO" "$LOG_FILE" | grep -E "(status=sent|status=(bounced|deferred))" | wc -l)
# Check if the email count exceeds the threshold
if [ "$EMAIL_COUNT" -ge "$THRESHOLD" ]; then
echo "Email count in the last minute: $EMAIL_COUNT. Threshold exceeded. Sending notification."
# Send a notification email
echo "WARNING! Email Threshold Exceeded. Check postfix immediately!" | mail -s "Email Threshold Exceeded" kyle@mydomain.net.au
else
echo "Email count in the last minute: $EMAIL_COUNT. Threshold not exceeded."
fi
I added >> /dev/null 2>&1 to the end of the cron command that runs the script to suppress any outputs that job might be generating. Nothing more showing up in the log anymore.