I'm a bash scripting rookie and have been googling this scenario for about six hours to no avail. I have found segments of what I need but no comprehensive solution.
Here is the problem:
I need to write some code that will be able to check that 3 files exist (file1.txt
, file2.csv
and file3.log
). Before proceeding however, I need to confirm that file3.log
has stopped writing (this is to confirm that the script that creates the 3 files has finished successfully).
checking the existence of these files seems easy enough using something like:
if [ -f -e /path/to/file/file1.txt && /path/to/file/file2.csv && /path/to/file/file3.log]
then
# somehow check the exit status of file3.log
if [$? !=0]
#somehow loop (maybe every 5 minutes) until $?=0
done
OR
I was also thinking can I just avoid all of this together and just check the exit status of the initial script? but I wasn't sure because if there was some sort of failure and the files weren't created then that would be a serious problem because the next part of the scanning process takes about 2 days...
Sorry if this might seem like a stupid question, I'm so deep in the google "if-until-exit-zero-else..." hole that I have no idea what to do from here.
file3.log
a program, or the output of a program?