18.12 Backing Up and Restoring Your Mail Queue

The bad news about backing up and restoring your mail queue in /var/qmail/queue is that it's nearly impossible. The good news is that it's rarely necessary.

The filenames in qmail's queue directory are numbers that depend on the inode number of the file containing the text of the message. Backup and restore programs don't restore files using the same inodes that the files used when they were backed up, which means that if you back up the queue and then restore it, it won't work.

If you're moving your qmail queue from one disk to another, there are two general strategies. If you can run your system with both disks for a while, rename the old queue to something like /var/old-qmail, build two copies of qmail as described in Chapter 17 (one for the old queue and one for the new one) start up both copies so that new mail goes into the new queue while mail in the old queue is eventually delivered or bounces, and then delete the old queue and its copy of qmail. The other is just to bite the bullet and move the queue. To do that, first shut down both qmail-send and anything that might put mail into the queue, preferably by shutting down the system to single user. Then copy the queue to /var/qmail/queue.old on the new disk, and use Harald Hanche-Olsen's script at http://www.qmail.org/queue-rename to rename the files to their correct names based on their current inode numbers. You can also use the more complex queue-fix program for www.qmail.org, but for this purpose you don't need anything that fancy.

If your disk fails and you restore from backups, it's usually more trouble than it's worth to restore the queue. If your backup is more than a few minutes old, nearly all of the messages in the queue when it was dumped will have been delivered, and the only ones not delivered are likely to bogus addresses that will never be delivered. To clean out the queue, shut down qmail and anything that might try to queue mail, then delete any queued mail with rm -rf /var/qmail/queue/* (be sure to type that correctly), go to the directory where you built qmail and make setup check to recreate an empty queue, and then restart qmail.



qmail
qmail
ISBN: 1565926285
EAN: 2147483647
Year: 2006
Pages: 152

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net