Use the locked file for essentially nothing other than the Highlander lock. After obtaining the lock, write the most recent pid to a separate logfile that isn't flocked.
The logfile could have the PID written into it and then be closed immediately. No other process will write to your logfile because the semaphore file is locked, assuring "only one." But when you find that you need to kill your process, you can open the log file and inspect it, since it's not actually the file that is getting locked.
Dave
In reply to Re: File locking; downgrade an exclusive to a shared lock
by davido
in thread File locking; downgrade an exclusive to a shared lock
by The_Dj
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |