LOL In unix there are a thousand ways to do something.

I use diff [file 1] [file 2] and pipe the out put to /dev/null. I evaluate
the return code to see if the file is different. A return code of zero is
identical.

My scripts more involved since I do logging and email notification for
failures, and keep copies of the last 10 changes.

Here is a code snippet for borne shell to get you started.

if [ ! -s /tmp/file1 ]
then echo "File 1 does not exist or is zero length"
     exit
fi


if [ ! -s /tmp/file2 ]
then echo "File 2 does not exist or is zero length"
     exit
fi

diff /tmp/file1 /tmp/file2 > /dev/null

if [ $? -eq 0 ]
then echo "files are the same"
else echo "files are different"
fi

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> On Behalf Of Grant Griffith
> Sent: Thursday, November 02, 2006 1:56 PM
> To: IMGate@mgw2.MEIway.com
> Subject: [IMGate] Re: transport.map auto updated.
> 
> I am new to the *nix side of scripting.  How can you check to see if the
> file changed or not?  Is it by timestamp or some type of comparison?
> 
> Thanks,
> Grant Griffith
> Web Application Developer
> Enhanced Telecommunications
> http://www.etczone.com
> 812-932-1000
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Ed Lucero
> Sent: Thursday, November 02, 2006 4:45 PM
> To: IMGate@mgw2.MEIway.com
> Subject: [IMGate] Re: transport.map auto updated.
> 
> Yes. That should work. I check every 15 minutes and see if my map has
> changed. If it has then I save a copy and update the map.
> 
> When a map gets updated it puts an exclusive lock on the table and
> causes
> all mail processing for processes requiring access to that table to stop
> until the lock is released. I'm not sure if it stops and restarts the
> smtpd
> processes.
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> > On Behalf Of Grant Griffith
> > Sent: Wednesday, November 01, 2006 8:19 PM
> > To: IMGate@mgw2.MEIway.com
> > Subject: [IMGate] transport.map auto updated.
> >=20
> > Hello All,
> >=20
> > I updated a script that was running hourly to update the relay
> > recipients to also update the transport.map database and it caused
> some
> > issues.  Can this file usually be updated while postfix is actually
> > running?
> >=20
> > The issue was, that after the time the new db was created, all
> messages
> > were rejected with a Relay Access Denied reason.  Seems some hours
> would
> > work, others would not.  I need to update this on a fairly regular
> basis
> > and was trying to automate it so that I did not have to do it
> manually.
> > So I upload a list of domains with the smtp:[ip.add.goes.here] at the
> > end of each.  Then uploaded to the IMGate server.  From there I ran
> the
> > postmap on the new transport.map file. =3D20
> >=20
> > Shouldn't that work?  I know Len, you did not want me doing this, but
> I
> > have enough manual things to do...
> >=20
> > Thanks,
> > Grant Griffith
> > Web Application Developer
> > Enhanced Telecommunications
> > http://www.etczone.com
> > 812-932-1000
> 
> 
> 



Reply via email to