I've got a bash script that runs on OSX.
It needs to manipulate some files on a network-share (AFP share on a Synology NAS).
Unfortunately those files are sometimes still being written when the script runs.
How do I determine if the file is in use or not ?
The normal method is by using "lsof", but that doesn't seem to work on network files if the other user is coming from another client on the LAN.
I could just attempt to rename the file. I suppose that will fail if the file is in use, but that is far from elegant.
Anybody have a better solution ?