I’m creating a bash script which will be run as a background process (’&’). In it I create a lock file at the start and delete it at the end but the file never appears.
In the bash script (just for testing) …
echo “$HOST:$$:$RUN_ID:$RUN_DATE” >$SYNC_LOCK_FILE
commented out code
sleep 120
rm $SYNC_LOCK_FILE
As I say, I launch the script as a background process with ‘&’ and search for the lock file but I don’t see it with ls etc :(.
My guess is that the file is opened but not actually created or registered by the file system until the script completes so the fact that it’s deleted later in the script is the reason it’s never found.
What can I do to make sure that this lock file exists and is available to other processes while this script is in progress?
Alan