in reply to Concurrent file access with flock()
If the script somehow dies between the truncate and the close command, the file will become empty. Are you by any chance printing something (the value of the counter) between the truncate and the close? If so, the script may die because it gets a SIGPIPE.
|
|---|