Came across an interesting problem today. My MailQueue was overloaded causing sendmail to go nuts apon a system reboot. (Load was insanely high!) so I figured i'd delete the pending mail in the following locations:
/var/spool/mqueue
/var/spool/mqueue-client
Delete em:
# rm ./*
But alas I was greeted by:
/bin/rm: Argument list too long.
Say what? Just *how* many files are we talking about here?
# ls -l |wc -l
32832
Even worse for the other folder! Swwaaahoooiiiieeeh? Unfortunately telling the rm application to remove that many files are a little out of its boundaries, so how to fix it? Simple, take the find command and pipe it to rm instead like so (this also works if the there are spaces in the filenames):
# find . -print0 | xargs -0 rm
If you want to filter it (so only say 'dfl81*' files are deleted):
# find . -name 'dfl81*' -print0 | xargs -0 rm
I still havent looked at why there were so many emails in the queue. My guess would be the SVK mirror'ing I do from home to pickup changes in Mercury (our uni's SVN Repo).