I have a shell script, That writes a content in to the file,
#!/bin/bash
SLEEP=1
FILE_PATH=${1}
while true
do
ps aux wc -l > ${FILE_PATH}
sleep ${SLEEP}
done
I have another PHP Script that reads the content of the file using file_get_contents(). I am aware that file_get_contents() will make a LOCK_EX (Exclusive lock).
My Question is,
- Will the shell script lock the file while writing in to the file? if yes what type of lock will it use exclusive, shared ..?
- Since My PHP Script is also locking the file, will it stop shell script from writing and make the file unavailable for shell script?
Since i am writing the file in shell script in 1 sec interval. I am afraid of the chances of file writing/reading getting failed in both the scripts.