For whatever reason, spammers found a way to relay mail through a side-system. The exploit has already been addressed.
The problem is that I had massive amount of emails in my /var/spool/mqueue directory (at least 100,000+) that I still need to filter through. I stopped sendmail and moved the contents of the mqueue directory to a new location...
Since then, I've been trying to use the following one liner to help:
for x in `find . -type f -name “qf*” | xargs grep -l "foo" | cut -b3-`; do y=d`echo $x | cut -b2-`; mv $x /root/spammessages; mv $y /root/spammessages/; done
The idea being to:
1) check QF files for unique spam-related header content (foo).
2) Find the DF counterpart file
3) Move both df and qf files to a isolated area.
The problem is that the query is running but doesn't look to be moving any files. If I run top, I see xargs and grep occasionally using some resources but never more than 1%-2%. Furthermore... when I check the spammessages folder, I don't see any files there.
If I run the same command on a smaller sub-set of messages, it seems to work fine. Are there some linux file limitations here? Are there ways to optimize the one-liner?