When a linux server does not allow sendmail port out but the service is running..
it will cause all the mail is in queue at the /var/spool/clientmqueue/..
due the mail cannot send out..
When left it like this all the time..
It will consume a large hard disk space..
what I face at here was, this directory had consume about 6G of the hard disk space..
When I run ls at the path, the server will hang..
nothing is about come out... for about roughly 1 or 2 hour or longer..
But when I df -h, the /var directory still have 2G available..
Although there had space but nothing can be start due to the error "not enough space to run services"..
What I can do is.. I try rm -rf * at the /var/spool/clientmqueue/..
"argument list too long error will appear"
Therefore, have to manually rm -rf one by one of the file with the mask attribute (*) at the send... example rm -rf Qm3w*
But this way consume a lot of energy and time.. and the space not decrease also..
Is totally waste of time..
So I try browse and google... I found out.. some solution.
Due to I not using sendmail at all.. I will disable the sendmail service.
By rename the file /etc/mail/submit.cf to /etc/mail/submit.cf.bak
Then I restart the sendmail service... The service cannot be start due to the
"Starting sm-client: /etc/mail/submit.cf: line 0: cannot open: No such file or directory"
Therefore.. my sendmail will not run anymore... Then I deal with the /var/spool/clientmqueue/ path by deleting all the file inside...
I use this command at /var/spool/clientmqueue/
"find . -type f -exec rm {} \;"
Left it run overnight.. and... the file at the directory is completely deleted...
Monday, December 14, 2009
Subscribe to:
Post Comments (Atom)
9 comments:
find . -type f -print0 | xargs -0 rm
is much faster then
find . -type f -exec rm {} \;
that true.. but if there are too many files. will have error such as
xargs: argument line too long
I've just deleted 987,567 files in clientmqueue using `find . -type f -print0 | xargs -0 rm'
As it passes each individual file to rm, I doubt it will ever see too argument line too long...
hmm... i do delete in this directory.. but I do get this error.
Have to check it in future when the files grow larger..
Will update here once again..
Thanks Sam for doing some running one the command. ^^
chkconfig --levels 0123456 sendmail off
then
/etc/init.d/sendmail stop
will turn sendmail off and it wont start again
thanks and nice
i use "find . -type f -print0 | xargs -0 rm"
and its work nice for me
thanks for share the tricks
Start your "sendmail" to flush the qued emails ;)
thanks for sharing, will try this out. Cheers
The xargs command will take all the "things" passed to it on STDIN, then run the command you tell it to with those argumants. Depending on some things, including switches to xargs itself, it might run the command once per item from STDIN, but the default behavior is to take as many of those as it can fit on a command line without making it too long, run that, and repeat the process until all the parameters have been handled. In other words, xargs is smart about constructing commands that will not have "too many arguments" nor be "too long".
Post a Comment