Inode Preservation Possible?
Neal at Morgan-Systems.com
Fri May 9 18:42:48 IST 2008
Julian Field wrote:
> Neal Morgan wrote:
> > Hi Julian and list!
> > I've been using MailScanner with ZMailer successfully for some time.
> > One thing I didn't like was the fact that there was a "disconnect"
> > the logs (syslog, mail) between the message ID when received by
> > handed off to MS, taken again by router/scheduler. This made it
> > difficult to diagnose problems with individual messages.
> > I'll try to keep the background info short. Zmailer derives a
> > ID from the inode and create date. If I could keep the message in
> > same/original file, the logging would stay correct from ZM to MS and
> > back.
> > I managed to build on the work of others (Carlos?), added some of my
> > scripts to preserve the original inode through copying and cat'ing.
> > works but it's kind of ugly.
> > So, the question is, would it be possible to make MailScanner do
> > for me? In other words, don't delete the incoming file, instead
> > to its work area, perform whatever changes are necessary, then put
> > altered content BACK into the original file so the inode would be
> > preserved?
> And what happens when the power dies or the OS crashes when you are
> half-way through over-writing the content of the original file? I
> like this *at all*, sorry.
> > ...finally, and equally important, use a "mv" to put in the
> > outgoing folder rather than copying.
> I can only mv if I'm not modifying the file.
> MailScanner never "owns" a message, as a power outage or crash could
> cause you to lose a message.
Thanks for your feedback.
That's a valid concern. My ugly hack addresses this by keeping the
original and sending a copy to MS. The original is only touched when I
have a valid match in output from MS. At this point, the contents of
the original are replaced with the contents of the file from MS. If
there were a problem I still have the output from MS, so I haven't lost
What I'm trying to accomplish here is to have a complete audit trail in
syslog as the message moves through the various processes. It's a real
pain in the neck to troubleshoot if the ID changes when the messages
enters MS and is returned.
Below is a sample of what I've managed to accomplish with my hack. (If
you know the message of interest was "S1049805AbYEIRIA" when received by
smtpserver, you can grep for that in syslog).
I'm just wondering if there is a better way to accomplish this:
10:08:00 smtpserver: S1049805AbYEIRIA: (9813c) accepted from
10:08:15 MailScanner: ZMMS: (S1049805AbYEIRIA) ID=1049805
10:08:15 MailScanner: ZMMS: (S1049805AbYEIRIA) Creating rename
map: D/1065521 back to D/1049805
10:08:27 router: ZMMS: (S1049805AbYEIRIA) D/1049805 has been
scanned and is now being routed
10:08:27 router: S1049805AbYEIRIA:
from=<someaddress at myserver.org>, <snip>
10:08:27 smtp: S1049805AbYEIRIA: to=<someotheraddress
someaddress at myserver.org>, delay=<snip>
10:08:27 scheduler: S1049805AbYEIRIA: complete (total 1
recipients, 0 failed)
With the default MS/ZM setup, the "S1049805AbYEIRIA" ID would have
changed at least once, and there would be no way to draw a conclusion
about what its new ID is without manually scanning the order of syslog
recs and trying to interpolate. (That ID is derived from inode and
create date. A new file back from MS generates a different ID.)
Thanks again for your feedback. If you don't have any other suggestions
I guess I'll just keep my hack...
More information about the MailScanner