Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

Queue Management with Qmail

Brand new ar­ti­cle, just fin­ished writ­ing it.

This ar­ti­cle de­scribes the queue sys­tem of qmail, and the tools you can use to man­age it. Al­so, it in­tro­duces a new one, called qmail-­clean­er, to find mes­sages in the queue that match a giv­en reg­u­lar ex­pres­sion.

MZM / 2006-04-03 04:54:

BUG: At page bottom link is "a href="www.qmail.org"" in mozilla turns to http://www.pycs.net/lateral/stories/www.qmail.org => results in 404. Missing protocol http.

Stuart / 2006-04-03 04:55:

There may not be a qmail-cleaner script, but google for qmail-remove and you'll find a python script that does a little of what you're asking. The only thing I don't like about qmail-remove is the fact that you have you stop qmail to remove messages from the queue without running a risk of damaging your queue.

Marcos / 2006-04-03 04:55:

I have this error when a tried to run qmail-cleaner.py:



[root@pandora QMail]# ./qmail-cleaner.py --header=test -v

Searching messages with headers matching: test



Traceback (most recent call last):

File "./qmail-cleaner.py", line 80, in ?

check (msgdir+"/"+dir+"/"+file)

File "./qmail-cleaner.py", line 55, in check

for line in open(message):

TypeError: loop over non-sequence

Roberto Alsina / 2006-04-03 04:56:

Stuart: The stop qmail problem is general. If you find a script that says you don't need to do it, the script is broken :-)



Marcos: Can you tell me the python version you are using? Iterating over a file

is rather new. I can send you a patched version for older python, if you want.



MZM: thanks!

Carl Parrish / 2006-04-03 07:16:

I made some changes. First of all my version of python (2.3.3) needed to import optparse instead of optik. Next for my needs I needed to match against the Return-path. so I added an opion and changed the dir to /info. Finally I used qmail-clean to call qmHandle do delete each msg (it would proably have been cleaner to do the delete in qmail-clean itself but I was in a hurry). Let me know if you're interested in the changes. What's the licsense on qmail-clean? is it GPL?

Chris Stinson / 2006-04-03 10:55:

Anyone know what this error message is.....1088852852.207365 alert: unable to opendir info/1, sleeping...

Chris Stinson / 2006-04-03 10:56:

The above problem has been fixed. I just have to find out a way to fix all of the bounced messages that are filling up my queue. I try to use the cleaner but get the error message.



Traceback (innermost last):

File "./qmail-cleaner.py", line 7, in ?

from optik import OptionParser

ImportError: No module named optik



I installed optik but still get an error message saying it isn't there....

Carl Parrish / 2006-04-03 10:56:

Chris did you read my post? You have to change optik to optparse in any recent version of python. I'm getting ready to post my version on my website if you want to take a look.

Chris Stinson / 2006-04-03 11:01:

Where can I get this optparse module?

Carl Parrish / 2006-04-03 11:02:

In python 2.3.3 its in with the standard modules.

Roberto Alsina / 2006-04-03 11:05:

The license for this is public domain, do as you please. If you send me your version, I will publish it.



The reason to use qmHandle to delete the files is that it stops the queue processing.



Not stopping it is what causes that error about a missing file: qmail just deleted it before you.

John Pritchard / 2006-04-04 01:18:



here's a nasty little devil that will purge your bounces.. need to run qmailctl stop, and kill qmail-send if necessary.. then install this into qmail/queue, and have mod (below) compiled and in path.. if you manage that this might just not destroy your qmail..

1 #!/bin/bash

2

3 for bounce in bounce/*

4 do

5 rm $bounce

6 mid=$(basename $bounce)

7 int=$(echo "$mid 23" | mod)

8 msg=${int}/${mid}

9 for test in mess intd info local remote

10 do

11 file=${test}/${msg}

12 if [ -f ${file} ]

13 then

14 rm $file

15 fi

16 done

17 done



/* mod.c

*/

1

2 #include

3 /*

4 *

5 *

6 * jdp

7 */

8 int main( char** argv, int argc){

9 int a, b, c;

10 fscanf(stdin,"%d %d",&a;,&b;);

11 c = a % b;

12 fprintf(stdout,"%dn",c);

13 return 0;

14 }

15


Contents © 2000-2023 Roberto Alsina