how to clear queue mail?

hehachris

Verified User
Joined
Nov 24, 2004
Messages
598
Location
Hong Kong
To remove all mail queues:

exim -bp | awk '/^ *[0-9]+[mhd]/{print "exim -Mrm " $3}' | sh


yea! just a single command!
 

pongzaa

Verified User
Joined
Oct 31, 2006
Messages
33
Thank you hehachris

But pls specify command line clearly.

I ssh to root then i should type what command ?

Thank you.
 

pongzaa

Verified User
Joined
Oct 31, 2006
Messages
33
thank you hehachris

But i typed like that, it's not work.

I know that email is sending to keep at /var/spool/exim/input and /msglog

I should delete these two folders, but it 's too long.

I couldn't remove with command rm *

can you tell me what command line to remove all files or remove each 500 files until empty.

Thank you

Pong
 

toml

Verified User
Joined
Oct 3, 2003
Messages
1,197
Location
Scottsdale, AZ
pongzaa said:
thank you hehachris

But i typed like that, it's not work.

I know that email is sending to keep at /var/spool/exim/input and /msglog

I should delete these two folders, but it 's too long.

I couldn't remove with command rm *

can you tell me what command line to remove all files or remove each 500 files until empty.

Thank you

Pong
Which part didn't work? I don't see anything in his command that would cause a problem.

Perhaps something like this might be easier for you to type:
cd /var/spool/exim/msglog
for file in `ls -1`
do
exim -Mrm $file
done
Just make sure the quotes around ls -1 are the back ticks not the single quotes.
 

kke

Verified User
Joined
Apr 4, 2006
Messages
202
Location
Thailand
When you have too many files in a folder
and you pass a parameter * that will represent for a large number of files you will get an error (FreeBSD)

What I ever success delete >100000 mqueues in spools is

remember folder owner and permission
rm -R /var/spool/exim/input (this will take a long time but not error)
then create the empty one back
 

pongzaa

Verified User
Joined
Oct 31, 2006
Messages
33
kke said:
When you have too many files in a folder
and you pass a parameter * that will represent for a large number of files you will get an error (FreeBSD)

What I ever success delete >100000 mqueues in spools is

remember folder owner and permission
rm -R /var/spool/exim/input (this will take a long time but not error)
then create the empty one back
Thank you kke

I got resolve this from DA already, it works

this is simple command for newbies like me.

cd /var/spool
mv exim exim.old
mkdir -p exim/input
mkdir -p exim/msglog
mkdir -p exim/db
chown -R mail:mail exim
/sbin/service exim restart

Then delete the old spool:

rm -rf exim.old
 

nobaloney

NoBaloney Internet Svcs - In Memoriam †
Joined
Jun 16, 2003
Messages
26,119
Location
California
Yes, you can put it into a shell-script, and call the script from a cronjob. However if you do that you will from time to time delete good email waiting to go out; you WILL lose outgoing email, and occasional incoming email.

Note I don't recommend manually deleting mail queues; it gets exim confused. I'd much rather use exim commands for removing email from the queue.

See Brad's exim cheatsheet.

Jeff
 
Top