source: doc/qmqtool.doc.txt @ 3

Revision 3, 10.4 KB checked in by jake, 4 years ago (diff)

Brought up to date for new packages

Line 
1qmqtool v1.13
2Copyright 2003-2006 Jeremy Kister
3http://jeremy.kister.net/code/qmqtool/
4
5qmqtool is a qmail queue manipulation program geared towards the
6viewing and safe modification of the contents in a qmail queue.
7
8qmqtool may be copied and distributed under the terms found in the
9Perl "Artistic License".  A copy of this license may be found in the
10standard Perl distribution, or in the file "Artistic".
11
12please report all bugs to: qmqtool-devel @t jeremykister.com.
13
14qmqtool was designed with Michele Beltrame's "qmHandle" in mind,
15however no source code from qmHandle was used within qmqtool.
16
17qmqtool is significantly faster than qmHandle 1.2.0 on my system,
18even though it has more work to do (such as examining the todo queue):
19
20> time qmqtool -s
21Messages in local queue: 0
22Messages in remote queue: 0
23Messages in todo queue: 0
24
25real    0m0.777s
26user    0m0.650s
27sys     0m0.110s
28> time qmHandle -s
29Messages in local queue: 0
30Messages in remote queue: 0
31
32real    0m3.746s
33user    0m3.110s
34sys     0m0.360s
35
36
37Notes:
38
39This program makes use of several shell utilities, such as "ps"
40and "grep".  Please ensure the syntax to these utilities are correct
41for your operating system (i.e. ps -ef vs ps auxc).  Also note that
42GNU's grep is much faster than Solaris's grep, so you should consider
43telling qmqtool to use it, as your searches (with -f) will be about
44five times faster.  GNU grep can also use a pipe as a logical OR
45(i.e. qmqtool -f 'this|that').
46
47qmqtool supports many arguments, each which must be used separately
48unless specifically allowed.  All syntax is described with qmqtool -h.
49
50qmqtool [-l] [-L] [-R] [-T]
51   show queue information: use -l for all parts of the queue, -L for
52        local, -R for remote, or -T for todo.
53
54        qmqtool starts by stating the message number, followed by a space,
55        an open-parenthesis, the message number, the string 'remote' or
56        'local' (representing which part of the queue the message is in),
57        followed by a close-parenthesis.  It continues displaying
58        "Envelope Sender", "Envelope Recipient", "From", "To",
59        "Subject", and "Date", if it can.  Lastly, it displays the
60        size of the message, in the highest reasonable unit, followed
61        by an empty line.  Note that using the -l option does not
62        include information about the "todo queue".  After all
63        messages are displayed, it then prints a few statistics
64        similar to running qmqtool -s.
65       
66qmqtool [-l] [-L] [-R] [-T] -Q
67        will print just the message names listed in the given queue,
68        separated by a comma.  will print 0 if there are no messages
69        contained in the requested queue.
70
71qmqtool -T
72        will list messages in the "todo queue".  This "queue" changes
73        very quickly, and will most likely be stale by the time you
74        can run qmqtool again.  It's useful to ensure your qmail-send
75        is running, as it is quite annoying when you've purposely
76        down'd the service, and forgot to restart it (todo will only
77        grow in this scenario).  It could also be useful if an evil
78        spammer's messages are being bounced through your machine --
79        you could disable qmail-send, look at the todo queue, find
80        the spammer, block the source, and eliminate his messages all
81        before they reach your queue.
82
83qmqtool -s -Q
84        will print the number of messages in the 'local', 'remote',
85        and 'todo' queues, in that order, one per line.  This is
86        very useful for graphing your queue via cricket/mrtg/cacti,
87        or, more importantly, monitoring your queue, with Argus.
88
89        check the contrib/argus/README and contrib/cricket/README
90        for more information.
91
92qmqtool -d -f 'STRING'
93        This will behave the same as qmqtool -dN, except that instead of
94        specifying the message ids, you specify a string.  For example:
95        qmqtool -d -f 'Football Game'
96        will delete all messages with 'Football Game' in it.
97       
98        Note this does not remind you to restart qmail-send, unless you
99        also specify -V (for verbose).
100
101        If used with -o N, will only show messages both older than N
102        hours, and containing STRING.
103
104qmqtool -d -o N
105        This will behave the same as qmqtool -dN, except that instead of
106        specifying a message id, you specify age (in hours).  For example,
107        to delete all messages that have been queued for 18 hours:
108        qmqtool -d -o 18
109
110qmqtool -c
111        using the chart listed in qmail's INTERNALS file, qmqtool will
112        try it's best to ensure each file in your queue is in a
113        consistent state.  Since the entire queue changes so rapidly,
114        the qmail-send program must be stopped before asking qmqtool
115        to check queue integrity.  Once it is stopped, qmqtool will
116        display found fragments of emails left behind from a most
117        likely clueless admin, who tried to delete messages directly
118        from the queue.  qmqtool could stop and start the queue
119        processing program for you, but it's author decided that it's
120        your job.
121
122qmqtool -r
123        will remove all fragments of messages deemed rouge by qmqtool
124        while using the -c option.
125
126qmqtool -i
127        will show how many messages are queued per ip.  this pays
128        attention only to the server that gave the message to us.
129        useful for tracking down an abuser.
130
131        will report '127.0.0.2' when qmqtool can not find who sent us
132        the message.  this usually happens when the message was
133        injected into the queue manually, ie via qmail-inject.
134
135        if your configuration uses front-end smtp servers who send their
136        messages to a set of backend servers, this option would not be
137        very helpful, as qmqtool would report the sending IP as the front-
138        end server.  To overcome this, you can supply an argument to -n,
139        specifing what smtp hop to pay attention to -- for example:
140
141        'qmqtool -i -n2' will sort the messages based on the second to
142        last server to handle the message.
143
144        use -V to display a third column containing message numbers that
145        this host has queued.
146
147qmqtool -S
148        similar to -i, except will show you how many bytes are
149        queued per ip.
150
151        note that the listed amount of bytes is not necessarily the amount
152        of bytes stored on your disk; a single 200 byte email sent to 10
153        envelope recipients will show up as 2000 bytes.
154
155qmqtool -eN
156        will expire message N, by setting the modified time to two weeks
157        ago on info/N, where N is the queued message number.  N may be a
158        message number, or multiple message numbers separated by a comma.
159        If the specified message is found in the todo queue, qmqtool will
160        warn you that todo messages are not expirable.
161
162qmqtool -e -f 'STRING'
163        This will behave the same as qmqtool -eN, except that instead of
164        specifying a message id, you specify a string.  For example:
165        qmqtool -e -f 'Football Game'
166        will expire all messages with 'Football Game' in it.
167
168        If used with -o N, will only expire messages both older than N
169        hours, and containing STRING.
170
171qmqtool -e -o N
172        This will behave the same as qmqtool -eN, except that instead of
173        specifying a message id, you specify age (in hours).  For example,
174        to expire all messages that have been queued for 18 hours:
175        qmqtool -e -o 18
176 
177qmqtool -uN
178        This option is sometimes referred to as "Re-Queueing"
179
180        will un-expire message N, by setting the modified time to now on
181        info/N, where N is the queued message number.  N may be a message
182        number, or multiple message numbers separated by a comma (,).  This
183        option may not be used with messages in the todo queue.
184
185        This may be useful when you never want a particular message to
186        be bounced after the default 7 day period.  For example, if
187        you are queuing mail for someone's currently off-line server,
188        you probably wouldn't want to bounce their mail after 7 days:
189        you'd want to keep it for them as long as you could, so that
190        when their server regains Internet access, the mail can be
191        delivered.
192
193        Although you could be using AutoTURN for this, it can be
194        achieved be using qmail itself.  Supposing the site's domain
195        name you are queuing for is "example.com", simply run
196        qmqtool -u -f "example\.com"
197        on a daily (or similar) basis, which will first find all
198        message numbers that contain the string "example.com" and
199        will then set the modification time to now: giving them an
200        extra 7 day life span in the queue.
201
202qmqtool -u -f 'STRING'
203        This will behave the same as qmqtool -uN, except that instead of
204        specifying a message id, you specify a string.  For example:
205        qmqtool -u -f 'Football Game'
206        will unexpire all messages with 'Football Game' in it.
207
208        If used with -o N, will only unexpire messages both older than N
209        hours, and containing STRING.
210
211qmqtool -u -o N
212        This will behave the same as qmqtool -uN, except that instead of
213        specifying a message id, you specify age (in hours).  For example,
214        to unexpire all messages that have been queued for 18 hours:
215        qmqtool -u -o 18
216
217qmqtool -E(A|R|L)
218        will set the expire time to [A]ll, [R]emote, or [L]ocal messages to
219        two weeks ago.  I don't know when this this function would be
220        useful, but can think of lots of times it'd be dangerous -- beware.
221
222qmqtool -U(A|R|L)
223        the same as qmqtool -E, except that it will set the
224        modification time to now, instead of two weeks ago.  Very
225        useful when you've just typed qmqtool -EA, and shouted "oh, shit!".
226
227        This function could also be useful if your qmail server's sole
228        purpose is a backup mail server:  you don't have to bother
229        looking for strings and un-expiring them individually, rather,
230        simply keep everything in the queue.
231
232        This option is sometimes referred to as "Re-Queueing"
233
234qmqtool -vN
235        will show you the first 100 lines of queued message N.  Limiting
236        the viewed message to 100 lines is good, because it trims off the
237        otherwise [hundreds of] thousands of useless encoded lines of
238        Microsoft worms.
239
240        use -w in conjunction with -v to view the whole message (i.e.
241        qmqtool -wvN (or qmqtool -w -v N).
242
243qmqtool -f 'STRING'
244        will print a comma separated list of message numbers who's
245        messages contain STRING.  Be sure to quote STRING, as spaces
246        are treated as possible new arguments on the command line.
247
248        note that STRING is a regexp; characters such as ^ ? . + ()
249        must be escaped appropriately.
250
251qmqtool -oN
252        will print a comma seperated list of messages numbers who have
253        been in the queue N or longer hours.
254   
255qmqtool -B(b|r)
256        will either (b)ackup the current queue in /var/qmail/queue/ to
257        /var/qmail/queue.backup/, or will (r)estore the queue in
258        /var/qmail/queue.backup/ to /var/qmail/queue/.
259       
260        Note that qmail-send must be stopped for this process.  Also
261        beware that the restore action does not replace the current
262        queue, rather, it appends to it.  The queue layout in
263        /var/qmail/queue must be correct before either backing it up
264        or restoring to it.  The easiest way to ensure this is to run
265        'make setup check' from the qmail-1.03 source directory.  Most
266        inconsitencies in queue structure will be backed up or
267        restored, as is.
Note: See TracBrowser for help on using the repository browser.