Subject: Re: Filesystem semantics question
To: Greg Hudson <ghudson@MIT.EDU>
From: <>
List: netbsd-help
Date: 12/04/1999 17:07:49
>The problem is this: on certain machines here, we rewrite four

>configuration files at boot time using a shell script, by moving aside

>the old versions and blatting out new ones with "echo".  Sometimes if

>the machines boot uncleanly after this process, the files are found to

>have zero length.=20


I can't answer all these questions, but from the sound of it you need a
safer method.  I would:

- write the new config file to xxx.new

- sync (to push the new file to disk)

- ln xxx xxx.old

- mv xxx.old xxx

- sync (to be sure the directories are saved)

Comments?  I suppose, at bottom, there's not a lot of difference between "mv
xxx xxx.old; mv xxx.new xxx" and my ln;mv, but the time during which xxx
doesn't exist should be quite short.




--