Originally Posted by jan61
of course you have to do the calculation again in every loop iteration - otherwise the $intvl
value doesn't change.
A short way:
while [ $(($(date +%s) - $(stat -c %Y /tmp/file))) -gt 60 ]; do
echo "I feel like sleeping"
echo "I worked for once"
P.S.: Your response was faster than mine ;-)
Just to add a little more "confusion" into the mix.
Here are the file names:
The stat I am using is:
stat -c %Y File_`date +%F`*.xml
with that said, if there are 2 files say:
Would that skew the result of:
intvl=$(($(date +%s) - $(stat -c %Y File_`date +%F`*.xml)))
while [ $(($(date +%s) - $(stat -c %Y File_`date +%F`*.xml))) -gt 60 ]; do
Should I just do a find for a file that was changed in the last 5 minutes, then have the stat check to see if it was done in the last 60 seconds to make sure that I'm only running against one file?
Thanks again for your help.