| 1 | Want to just get going ? Try: qmqtool -l |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | Q. How do I install qmqtool ? |
|---|
| 6 | A. vi qmqtool, and ensure the path and syntax to "ps" and "grep" are |
|---|
| 7 | compatible with your operating system (defined at the top) |
|---|
| 8 | cp qmqtool /usr/local/script/ |
|---|
| 9 | chmod 0700 /usr/local/script/qmqtool |
|---|
| 10 | chown root /usr/local/script/qmqtool |
|---|
| 11 | |
|---|
| 12 | Q. Why arent messages that I just expired going away ? |
|---|
| 13 | A. After expiring, you can force the queue to run by: |
|---|
| 14 | /var/qmail/bin/qmail-tcpok |
|---|
| 15 | svc -a /service/qmail-send/ |
|---|
| 16 | A. If you have already forced qmail to re-run the queue, you may be |
|---|
| 17 | running into a scenario where qmail-remote is caching an |
|---|
| 18 | unresponsive SMTP server, and messages after the first are kept in |
|---|
| 19 | the queue to be tried later. There's no solution to this problem, |
|---|
| 20 | besides to simply delete the messages instead of expire. |
|---|
| 21 | |
|---|
| 22 | Q. Do I really have to restart qmail-send after using -d ? |
|---|
| 23 | A. You should. qmail doesnt know you've removed the message from the |
|---|
| 24 | queue, and will keep trying to send it. Each time it tries, you'll |
|---|
| 25 | see a complaint in your log file. |
|---|
| 26 | |
|---|
| 27 | Q. What is the difference between 'expiring' and 'deleting' messages? |
|---|
| 28 | A. qmail remembers what messages are in it's queue. If you tinker |
|---|
| 29 | with the queue manually (via deleting a message), you will have |
|---|
| 30 | to restart qmail-send. By simply expiring the message, you trick |
|---|
| 31 | qmail into thinking the message has been in the queue too long |
|---|
| 32 | (about double the queuelifetime), and qmail gracefully removes the |
|---|
| 33 | message for you. |
|---|
| 34 | |
|---|
| 35 | Q. How can I list all messages that have the subject of |
|---|
| 36 | "Free Pupil Enlargment" ? |
|---|
| 37 | A. qmqtool -f '^Subject: Free Pupil Enlargment' |
|---|
| 38 | will do a pretty good job; since qmqtool's -f argument searches |
|---|
| 39 | the entire message, this could list an incorrect message if the |
|---|
| 40 | string 'Subject: Free Pupil Enlargment' is found in the body of |
|---|
| 41 | the email and not in the header. |
|---|
| 42 | |
|---|
| 43 | Q. How can I delete all messages with a subject of "Pupil Enlargment"? |
|---|
| 44 | A. qmqtool -d -f '^Subject: Pupil Enlargment!'` |
|---|
| 45 | restart qmail-send. |
|---|
| 46 | |
|---|
| 47 | Q. How can I show how many queued messages a host has sent? |
|---|
| 48 | A. If you've got a plain-vanilla qmail installation, try: qmqtool -i |
|---|
| 49 | If you've got frontend servers that relay mail to backend servers, |
|---|
| 50 | qmqtool -i -n 2 |
|---|
| 51 | You can also try qmqtool -i -V |
|---|
| 52 | |
|---|
| 53 | Q. How can I keep my queue clean of soon-to-be double bounces? |
|---|
| 54 | A. Enter the following single line into root's crontab (adjust for |
|---|
| 55 | syntax and path differences, of course): |
|---|
| 56 | 17,47 * * * * qmqtool -e -o 2 -f 'invoked for bounce|^Subject: failure notice' >/dev/null 2>&1 |
|---|
| 57 | This is not 100% accurate; some legitimate bounce messages will be |
|---|
| 58 | deleted. |
|---|
| 59 | |
|---|
| 60 | Q. How can I delete all messages from my remote and local queue ? |
|---|
| 61 | A. qmqtool -d -f . |
|---|
| 62 | restart qmail-send. |
|---|
| 63 | |
|---|
| 64 | Q. How can I delete multiple messages at a time ? |
|---|
| 65 | A. qmqtool -d 1234,5678 |
|---|
| 66 | |
|---|
| 67 | Q. How can I find out who most of my remotely queued messages are |
|---|
| 68 | destined for? |
|---|
| 69 | A. qmqtool -R | awk '/Recipient:/ { print $3 }' | sort | uniq -c | sort -n |
|---|
| 70 | (your awk, sort, and uniq syntax may differ) |
|---|
| 71 | |
|---|
| 72 | Q. How can I list messages with a subject of "Failure Notice" that |
|---|
| 73 | are 18+ hours old ? |
|---|
| 74 | A. qmqtool -o 18 -f '^Subject: Failure Notice' |
|---|
| 75 | |
|---|
| 76 | Q. How can I expire messages with a subject of "Failure Notice" that |
|---|
| 77 | are have been queued for 18+ hours ? |
|---|
| 78 | A. qmqtool -e -o 18 -f '^Subject: Failure Notice' |
|---|
| 79 | |
|---|
| 80 | Q. How can I do the previous question, but watch as it goes ? |
|---|
| 81 | A. use -V: qmqtool -V -e -o 18 -f '^Subject: Failure Notice' |
|---|
| 82 | |
|---|
| 83 | Q. How can I make a list of just queued bounce messages ? |
|---|
| 84 | A. qmqtool -f 'invoked for bounce' |
|---|
| 85 | will do a good job. |
|---|
| 86 | |
|---|
| 87 | Q. What is a "LWQ installation" ? |
|---|
| 88 | A. I (and the general qmail community) recommend installing qmail as |
|---|
| 89 | per http://www.lifewithqmail.org/ |
|---|
| 90 | |
|---|
| 91 | Q. How can I move qmail's queue to a different machine? |
|---|
| 92 | A. Use the backup and restore feature: |
|---|
| 93 | 1. On old machine: |
|---|
| 94 | stop qmail-send |
|---|
| 95 | qmqtool -Bb |
|---|
| 96 | cd /var/qmail |
|---|
| 97 | tar -zcvf queue.tgz queue.backup/ |
|---|
| 98 | copy or move queue.tgz to the new machine |
|---|
| 99 | |
|---|
| 100 | 2. On new machine: |
|---|
| 101 | cd /var/qmail |
|---|
| 102 | tar -zxvf queue.tgz |
|---|
| 103 | stop qmail-send |
|---|
| 104 | qmqtool -Br |
|---|
| 105 | start qmail-send |
|---|
| 106 | |
|---|
| 107 | Q. How can I view message number 12345 ? |
|---|
| 108 | A. qmqtool -v 12345 |
|---|
| 109 | |
|---|
| 110 | Q. How can I view the whole message 12345, instead of the first 100 lines? |
|---|
| 111 | A. qmqtool -wv 12345 |
|---|
| 112 | |
|---|