systemadmin.es > Correo > qmqtool: Herramienta para ver y modificar la cola de qmail

qmqtool: Herramienta para ver y modificar la cola de qmail

La herramienta qmqtool sirve para poder ver y modificar la cola del qmail. Permite realizar búsquedas sobre ella para eliminar mensajes que tengamos detectados como problemáticos.

Para su instalación deberemos seguir los típicos pasos de configure make y make install:

cd /usr/local/src
wget http://jeremy.kister.net/code/qmqtool/files/qmqtool-1.14.tgz
tar xzf qmqtool-1.14.tgz 
cd qmqtool-1.14
./configure
make && make install

A continuación tendremos instalado el qmqtool en /usr/local/script/qmqtool, para poder usarlo sin modificar el PATH podemos crear un link:

ln -s /usr/local/script/qmqtool /usr/local/bin/

Ejecutando el comando sin parámetros podemos ver todas sus opciones:

# qmqtool
        qmqtool version 1.14
        syntax: qmqtool [-l] [-L] [-R] [-S [-nN]] [-T] [-s] [-Q] [-c] [-r] [-i [-nN]] [-V]
                        [-E(A|R|L)] [-U(A|R|L)] [-vN [-w]] [-e(N|[-f 'STRING'][-oN])] [-u(N|[-f 'STRING'][-oN])]
                        [-d(N|[-f 'STRING'][-oN])] [-f 'STRING'] [-oN] [-B(b|r)] [-x(N|[-f 'STRING'][-oN])]

        -l              list messages in all parts of the queue
        -L              list messages with local recipients
        -R              list messages with remote recipients
        -T              list messages not completely processed
        -s              show statistical information
        -Q              be as quiet as possible (useful for snmp, cron, and such)
        -V              be more verbose
        -B
          b             Backup queue into /var/qmail/queue.backup/
          r             Restore backup from /var/qmail/queue.backup/
        -c              check queue consitancy
        -r              repair queue (by deleting fragments) found by checking queue consistancy
        -i              show how many messages are queued per ip address
           -nN          pay attention to the Nth last smtp-hop
        -S              show how many bytes are queued per ip address
        -e              expire message
                        may specify N (multiples may be comma separated), or -f 'STRING' and/or -o N
        -u              unexpire message
                        may specify N (multiples may be comma separated), or -f 'STRING' and/or -o N
        -d              delete message
                        may specify N (multiples may be comma separated), or -f 'STRING' and/or -o N
        -E              expire messages in [A]ll, [R]emote, or [L]ocal queues
        -U              unexpire messages in [A]ll, [R]emote, or [L]ocal queues
        -v
          N             view first 100 lines of message number N
          N -w          view whole message N
        -f 'STRING'     display comma separated list of message number(s) containing STRING.
                        prints 0 if no matches are found.
        -o N            display comma separated list of message number(s) older than N hours.
                        prints 0 if no matches are found.
        -x N            prints extended information on message N.  format identical to -l.
                        may specify N (multiples may be comma separated), or -f 'STRING' and/or -o N

        see the FAQ for examples.

Mediante -l podemos listar los mensajes que estan en cola:

# qmqtool -l
(...)
262751 (22, remote)
  Envelope Sender: info@systemadmin.es
  Envelope Recipient: ejemplo@super3.net (To Be Delivered)
  Date: Mon, 13 Jul 2009 22:24:12 +0200 (CEST)
  From: systemadmin.es <info@systemadmin.es>
  To: ejemplo@super3.net
  Subject: correo de ejemplo
  Size: 3.55KB (3636 Bytes)
(...)
Messages with local recipients: 1
Messages with remote recipients: 146

Mediante el parámetro -s podemos ver el conjunto de estadísticas:

# qmqtool -s
Messages with local recipients: 1
Messages with remote recipients: 145
Messages not yet preprocessed: 0
Total messages in queue: 146

En el caso que se quiera eliminar un conjunto de correos lo podemos hacer mediante -d y filtrar mediante -f con una cadena:

# qmqtool -d -f 'info'

Deja un comentario:

XHTML - Tags permitidos:<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>