Edit File: cleanmailqueue.sh
hn=$(hostname) result="`/usr/sbin/exim -bpc`" if [[ "$result" -gt 3000 ]] then echo "Found $result emails in Mail Queue Manager..." find /var/spool/exim/input/ -type f -exec rm -vf {} \; | bash > /dev/null 2>&1 echo "Deleted $result emails from Mail Queue Manager succesfully." echo "Setting everyone's package limit to 25 email per hour" `/usr/local/cpanel/scripts/pkgemail_limit.sh` > /dev/null 2>&1 echo "Email package limiting done." echo "Notifying Admin..." echo "Emails were successfully deleted but you must check the server for possible spamming activity." | mail -s "$result Emails deleted from mail Queue Manager in $hn" skillvent@gmail.com echo "Email Sent to skillvent@gmail.com" else echo "Everything seems to be normal. Mail queue has just $result emails which is less than 3000." fi