Help - Search - Members - Calendar
Full Version: Clear / Clean Qmail Queue Instantly
The Planet Forums > Control Panels > Plesk
MinisterAlan
Clear / Clean Qmail Queue Completely, Safely & Fast.

Here is a quick and easy way to clear all email from the queue.
This will not remove anything it should not remove. It just clears
all email from the queue safely. This is just for qmail.
( Not for use with any other email programs )

Thanks goes to my Friend Zike at RS / EV1.

1) login to your server via ssh
2) su -
3) wget http://wepraisehim.org/qmailclear.sh
5) sh qmailclear.sh or sh ./qmailclear.sh
6) done.

For those that receive oversized file truncting errors.
Use the following more intense script. It take a little
longer but gets the job done.

1) login to your server via ssh
2) su -
3) wget http://wepraisehim.org/qmailclean.sh
5) sh qmailclean.sh or sh ./qmailclean.sh
6) done.

Minister Alan Holden
We Praise Him Ministries
http://www.wepraisehim.com
jay
I appreciate it. Worked very well.
red77
Thank you very much, Very good work.
MinisterAlan
Happy it works for you.

Take Care. icon_smile.gif
McFunk
Is this normal? Here's what I'm getting when I run the script.

CODE
Clearing the Mail Queue

./qmailclear.sh: line 15: /bin/rm: Argument list too long

./qmailclear.sh: line 19: /bin/rm: Argument list too long

./qmailclear.sh: line 21: /bin/rm: Argument list too long

./qmailclear.sh: line 25: /bin/rm: Argument list too long

./qmailclear.sh: line 27: /bin/rm: Argument list too long

./qmailclear.sh: line 29: /bin/rm: Argument list too long

./qmailclear.sh: line 31: /bin/rm: Argument list too long

./qmailclear.sh: line 33: /bin/rm: Argument list too long

./qmailclear.sh: line 37: /bin/rm: Argument list too long

./qmailclear.sh: line 39: /bin/rm: Argument list too long

./qmailclear.sh: line 41: /bin/rm: Argument list too long

./qmailclear.sh: line 43: /bin/rm: Argument list too long

./qmailclear.sh: line 45: /bin/rm: Argument list too long

./qmailclear.sh: line 47: /bin/rm: Argument list too long

./qmailclear.sh: line 49: /bin/rm: Argument list too long

./qmailclear.sh: line 51: /bin/rm: Argument list too long

./qmailclear.sh: line 53: /bin/rm: Argument list too long

./qmailclear.sh: line 55: /bin/rm: Argument list too long

Info folder clean, clearing mess folder

./qmailclear.sh: line 65: /bin/rm: Argument list too long

./qmailclear.sh: line 69: /bin/rm: Argument list too long

./qmailclear.sh: line 71: /bin/rm: Argument list too long

./qmailclear.sh: line 75: /bin/rm: Argument list too long

./qmailclear.sh: line 77: /bin/rm: Argument list too long
McFunk
Here are the end results:

CODE
./qmailclear.sh: line 153: /bin/rm: Argument list too long

./qmailclear.sh: line 155: /bin/rm: Argument list too long

Remote folder clean, clearing intd folder

Intd folder clean, clearing local folder

Local folder clean, clearing todo folder

Mail queue cleaned

Re-Start Qmail Now !

Starting qmail:  [  OK  ]

Qmail Started - MinisterAlan

Done !

[root@myserver temp]# /var/qmail/bin/qmail-qstat

messages in queue: 552461

messages in queue but not yet preprocessed: 0

[root@redteam temp]#
MinisterAlan
Ok,

This is not a problem.
Your queue is just so large that this small script can't clear it
which doesn't happen very often.

However,
In another posting I have another script but I will post it here too.
It takes a little longer to run but it will clear the queue.

The following is all done from command line ( root )

Do,
wget http://www.wepraisehim.org/qmailclean.sh

Then run, sh qmailclean.sh

DO NOT restart any process, reboot, etc... Until the script says it is done.
If you do, it will break qmail. This script is tried and true safe if you let
it run until complete.

Take Care.

Sincerely,
Minister Alan Holden
vien
Hey Pastor (MinisterAlan):
Praise Jesus Men, and am so glad by way you lift him up .. Thanks.

Men, am in trouble ..Lately like 2 weeks my server is not sending emails at all. Till yesterday when it blacked out!!.

Some body did the checking of qmail msgs and am told they are over 70,000 msgs in the queue.

Do you think following your instructions above will help solve the problem without necessarily stoping qmail first?

Should I go ahead and just do what you instructed above?

Thanks and Men, God Be With You.
MinisterAlan
Hi Friend,

Thank you for the kind words.

If the qmailclear.sh script won't clear it. Go ahead an run the qmailclean.sh script.
That's the only way to clean the queue and it really won't take that long.

Please let me know how it goes for you. I'm sure you will send me a good report.

Be Blessed.

Sincerely,
Minister Alan Holden
vien
Hi Pastor;
I did run the cleaner and it were successfull. Thanks a Bunch. One more question however, what would these statements mean:

[root@host110 control]# /var/qmail/bin/qmail-qstat
messages in queue: 28
messages in queue but not yet preprocessed: 0

When do I know there are emails failing to be delivered: ie I have a value>0 on [messages in queue but not yet preprocessed:] would messages in queue matter when I wake up one morning and it has 20000?

Am kind of a newbie really in this field.

Thanks otherwise for your help and May The Lord Bless Thee
rkane
Do I lose all email in the queue when I run the clean script? I don't want to cause my customers to lose email. But I'm not sure the email are sending properly. I have a queue that is staying pretty steady at 250 messages. How do I know that all my messages are going out like they are supposed to?

Thanks, and god Bless.


I would like to comment that I am happy to have found a community I can post to who will not start a debate becuase I Thank God when he helps me find a solution.
MinisterAlan
Friend.
Amen to you last comment.

If your queue is only at 250 I really don't think you need to clear it.
I will guess you are running plesk.
However, messages that stay in the queue for a long period of time
should be removed as they will never be delivered due to other isp's
not allowing them to be delivered.

If the above is the case, run the qmailclear.sh script every few days
to keep you queue as clean as possible.

May God Bless.

Sincerely,
Minister Alan Holden
WePraiseHim.com
Which is now http://www.funlaugh.com because the name of Jesus
and God were getting bounced back to use as bad laug. found in email.
Such is our world today. GOD Help Us !
MinisterAlan
Friend..
If you have that many emails remaining in the queue.
The are not getting delivered at all. The are just going
to sit there until you clear them.

Best Of Luck.

Sincerely,
Minister Alan Holden
WePraiseHim.com
Which is now http://www.funlaugh.com because the name of Jesus
and God were getting bounced back to use as bad laug. found in email.
Such is our world today. GOD Help Us !
cevilian
MinisterAlan,
I looked into the scripts you posted, looks like the scripts will remove all the messages in the queue (am I right?). Is it possible to remove messages that are older than certain age (or meet some other criteria?)?

My queue is full of bounce messages and I dont have qmail-remove. Is qmail-remove installation any different on a shared hosting box?

Thank you
bsucards
I have been having similar problems, but have not run your script yet. I am getting a lot of messages sitting in the open que. This has been an ongoing problem with the server. Finally I got someone from support to actually look at it, and here is what they said:


Checking into this problem I have found that the queue for qmail is not being cleared out. I have cleared most of the info out how ever there are still about 1k worth of mail that is in there. We suggest trying to clear out all the mail from the queue to see if this will help on the problem. I also checked over you qmila conf and it looks good. The only other thing I can see that you maybe need to do is set up TXT records in DNS. After all most of the mails that are in the queue are e-mails being returned to send for fallers.



Wanted to see your suggestions on this?
lvalics
A very new solution is in Power Toys, Qmail Manager, you can search after text in message and cleanup only that mails.

http://www.web-hosting-control-panel-addon...ys_for_PLESK/1/ - see here.

In PLESK 8 this will be included.
vien
You are the boy of the year! thanks man for that notification .. its a great tool I suppose.. though havent gotten to the download link!
QUOTE (lvalics)
A very new solution is in Power Toys, Qmail Manager, you can search after text in message and cleanup only that mails.

http://www.web-hosting-control-panel-addon...ys_for_PLESK/1/ - see here.

In PLESK 8 this will be included.
lvalics
I'n glad you like it, we will add new features soon, just wait PLESK 8 ...
omansur
QUOTE (MinisterAlan @ Oct 4 2004, 06:46 AM) *
Clear / Clean Qmail Queue Completely, Safely & Fast.
Here is a quick and easy way to clear all email from the queue.
This will not remove anything it should not remove. It just clears
all email from the queue safely. This is just for qmail.
( Not for use with any other email programs )
Thanks goes to my Friend Zike at RS / EV1.
1) login to your server via ssh
2) su -
3) wget http://wepraisehim.org/qmailclear.sh
5) sh qmailclear.sh or sh ./qmailclear.sh
6) done.
For those that receive oversized file truncting errors.
Use the following more intense script. It take a little
longer but gets the job done.
1) login to your server via ssh
2) su -
3) wget http://wepraisehim.org/qmailclean.sh
5) sh qmailclean.sh or sh ./qmailclean.sh
6) done.
Minister Alan Holden
We Praise Him Ministries
http://www.wepraisehim.com

Hi. I tried this and it worked well, but now my Queue is stuck and email is not being delivered to any users. "Messages in queue: 415 not preprocessed, 35 local, 4 remote, 454 total." Any idea? Thanks for the help.
Squire
Sounds like you didn't stop qmail first omansur. eg service qmail stop You should always stop qmail before trying to clean out the queue, or doing anything with the queue really.

Instructions for rebuilding qmail's queue are in this knowledgebase entry.
vic4x4x4
please help.

I used qmailclean.sh and my internet got disconnected during the process and now my qmail is broken.

can anyone send me a step by step instruction on how I can fix this ? I'm a total newbie in this.

thanks
James Jhurani
Depending on your level of linux experience, you may want to try qmail-repair (http://pyropus.ca/software/queue-repair/). I've never had to use it myself, but i've seen multiple references to it on qmailrocks.org.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.