queue-fix 1.4
19990314
Copyright 1999
Eric Huss
e-huss@netmeridian.com
This is a small utility for checking and repairing the qmail queue
structure. It will fix uid/gid settings and permissions. It will
rename the message files to match their inodes. It will even create
directories and files that don't exist that should be there (you can
even create a queue from scratch). It will also print warnings for
any files it finds that should not exist.
Compiling:
1) Extract the tar file.
2) Edit conf-cc and conf-ld for your compiler.
3) If you changed conf-split when you compiled qmail, edit queue-fix.c
and change SPLIT_NUM to this value.
4) Type make.
This will produce the "queue-fix" executable.
How to use:
queue-fix [-i | -N] queue_directory
Use the -i option to go into interactive mode. In interactive mode,
it will prompt for confirmation before it begins a task.
Alternatively, you may use the -N option to go into test mode.
In test mode, queue-fix will print to standard output all the actions
queue-fix would normally do, but does not actually call them.
queue_directory is the location of the queue to fix.
For your safety, you should always make a backup of your queue before
running queue-fix.
Examples:
1) Moving your queue.
a) Shut down qmail-send. Wait for exiting to show up in the log.
Shut down qmail-smptd:
- if inetd, comment out of /etc/inetd.conf and send inetd
a HUP.
- if supervise, use svc -d to bring it down
Shut down any processes which may run qmail-queue. This includes,
but is not limited to qmqpd, pop, imapd, etc.
b) Choose the location for the new home of your queue. In this
example: originally in /var/qmail/queue
moving to /other/qmail/queue
c) cd /var/qmail
d) mv queue /other/qmail
e) queue-fix -i /other/qmail/queue
f) Run queue-fix again just to make sure it worked. If it prints
anything other than finished, then something is seriously
wrong.
g) Either make a link to the new queue location, or recompile
qmail with the new queue location.
h) Restart qmail and test it.
2) Reconstructing the file system.
a) Shut down qmail-send. Wait for exiting to show up in the log.
Shut down qmail-smptd:
- if inetd, comment out of /etc/inetd.conf and send inetd
a HUP.
- if supervise, use svc -d to bring it down
Shut down any processes which may run qmail-queue. This includes,
but is not limited to qmqpd, pop, imapd, etc.
b) Do whatever file system changes that you need to do.
c) queue-fix -i /var/qmail/queue
d) Run queue-fix again just to make sure it worked. If it prints
anything other than finished, then something is seriously
wrong.
e) Restart qmail and test it.
Extra Safety:
You must ensure that no other program modifies the queue while queue-fix
is running. If you are unsure whether or not something will try to use
the queue, type:
chmod 0 /var/qmail/bin/qmail-queue
before running queue-fix. This will assume that MUA's and other applications
that inject mail will recognize the failure to run qmail-queue.
Once you are done, type:
chmod 4711 /var/qmail/bin/qmail-queue
to get it going again.
Known faults:
- The error messages are not very descriptive of the problem.
- Responding "no" during interactive mode results in a confusing
error message.
- queue-fix checks for special files to exist in the queue, but does
not check their type (for example, a regular file existing where
there should be a named pipe).
Epilogue:
If you have problems, please let me know. I make no guarantees about
the quality of this program.
This utility as an experiment uses the libraries written by D. J.
Bernstein. Thanks!