OK gang, time for ultimate defensive driving here!
First: the semaphores will not help NFS one little bit, so drop em.
Now the plan:
1) Check to see if the file exists.
2) If it doesn't then open it for exclusive create with no buffering
(O_SYNC).
3) Write out the usual stuff.
4) (redundantly) flush it then close it.
5) Reopen the file for reading and check to see if it has what we
(hopefully) just wrote to it, and nothing more.
Fail on any error, complain to the log files (with an option to
mail the Admin) and clean up whatever seems to be resonable.
--
Henry J. Cobb hcobb at fly2.berkeley.edu SFB Tyrant