On Tue, 2004-02-10 at 13:36, Richard Gilbert wrote:
> cdb_encode.pl aliases | $(CDBMAKE) tmp_aliases.cdb aliases.tmp
> cdb_encode.pl invaliases | $(CDBMAKE) tmp_invaliases.cdb invaliases.tmp
> mv invaliases.cdb invaliases.cdb.old
> mv tmp_invaliases.cdb invaliases.cdb
> mv aliases.cdb aliases.cdb.old
> mv tmp_aliases.cdb aliases.cdb
This is mostly superfluous - cdbmake already does a rename(tmpfile,
realfile) as the last part of its operation.
I'd say you are suffering from one of 2 problems:-
1. Your filesystem does not follow full unix semantics, such as
fully atomic renames [can you say NFS]
2. You have 2 of these scripts running simultaneously and are
racing on the use of the *.tmp files.
To work round problem (2), use a .$$ phrase in the temporary filename to
make the filename more unique.
Nigel.
--
[ Nigel Metheringham Nigel.Metheringham@??? ]
[ - Comments in this message are my own and not ITO opinion/policy - ]