Opening the file by writing to it can lead to issues of people, waiting for your process to start, then placing a symlink to another file. It isn't easy and there is definitely an element of luck, but keep trying and you will hit it eventually. So create with an append, then test for the symlink if you are paranoid.
Incidentally another model to look at for sentinal files is Simple Locking.
In reply to RE (tilly) 2: lock files vs. non-predictable file names
by tilly
in thread lock files vs. non-predictable file names
by RuphSkunk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |