Another lateral approach, then. Add into your script a write of the PID to a second, non-locked file after it has successfully gained the exclusive lock. Then your kill-script just needs to read the second, unlocked file and compare its timestamp to that of the locked file (to make sure the second file is not stale).
Caveat: I'm not a Windows user, so this may be no use at all on that platform.
In reply to Re^3: File locking; downgrade an exclusive to a shared lock
by hippo
in thread File locking; downgrade an exclusive to a shared lock
by The_Dj
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |