PDA

View Full Version : how to clear queue mail?



pongzaa
10-31-2006, 02:06 AM
Pls explain step by step, i'm newbies.

Thank you.

hehachris
10-31-2006, 02:08 AM
To remove all mail queues:

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


yea! just a single command!

pongzaa
10-31-2006, 02:25 AM
Thank you hehachris

But pls specify command line clearly.

I ssh to root then i should type what command ?

Thank you.

hehachris
10-31-2006, 02:58 AM
exim -bp | awk '/^ *[0-9]+[mhd]/{print "exim -Mrm " $3}' | sh

pongzaa
10-31-2006, 10:08 PM
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
11-01-2006, 07:06 AM
Originally posted by pongzaa
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
11-01-2006, 08:37 AM
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
11-01-2006, 07:14 PM
Originally posted by kke
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

yatoula
06-17-2010, 01:45 PM
hi, thanks , but it's not possibe to create a cron job with this command ?
If it's possible, help me

nobaloney
06-18-2010, 08:53 AM
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 (http://bradthemad.org/tech/notes/exim_cheatsheet.php).

Jeff