Delete spam messages from sendmail queue
One website was hacked and was being used to send spam emails. Sendmail was making the server to halt because of high load!
After cleaning up the site and installing a Malware detector (maldet) I had to delete the messages from the sendmail queue so the server didnt kept getting a high load.
I created this simple bash script to work it out. Obviously you need to uncomment the rm command to make it work.
#!/bin/bash ls -1 | while read fn do if grep -E -q "Wrestling|Asian|pharma|sucking|masturbates|bondage|medic|experience|antidote|poison|presence|jerking|blowjob|boobies|mature|teen|loaded|virgin|noblefox.net|dong|hungers|brainwashing|heartfelt|slave|russian|mistress" "$fn" then if [[ "$fn" != "remove.sh" ]] then echo "would delete $fn" # rm $fn fi fi done