Script should keep checking for availability of files.

Hi,

I want my script to check for availability of few files contineously for some time.
Lets say from 10:00 AM to 10:30 AM script should keep checking on a particular location for each file one by one. If all the files are available then only it should complete the next processing part, else it should keep checking for the availability of the file. and after 10.30 AM the script should run completely as all files are available and if still file is not available by 10.30 then log error in logfile, but script should run by this time as it crossed the threshold 10.30.
If files available at 10.10 AM then script should run complete by the same time and no need to wait till 10.30.

thanks
Amit

How do we know all files are there? Example please

Hello Jim,

First of all thanks that finally you have replied to my post.
Now coming to my issue:

Lets say there are two server X1 and X2

  1. server X1 has to login to server X2 through script. --- I know how to do this.
  2. After reaching (cd /ab/bc/cd) to a specific path on X2 server, script has to search for specific files (say file1, file2, file3, file4 and file 5) --- I know how to do this.
  3. My script which is placed on X1 is running through crontab at 10.00 AM. Now, if the files of current date is available on X2 server path, then my script will pick those and copy on server X1.
    3.1 But in case, files of current date on server X2 are not avaialbe at 10.00 then my script will fail to pick the files from X2.
    3.2 HERE IS MY REQUIREMENT: I want my script to check on server X2 for the availability of current date's files from schedule time 10.00 to 10.30 AM in every 5 minutes, if the files of current date is not avaialble on X2.
    3.3 Anytime between 10.00 to 10.30 if files are arrived on X2, then my script should pick those and copy on X1. This should happen for all files (file1, file2, file3, file4 and file 5) on server X2.
    3.4 BUT incase, if file never arrives until 10.30, then script should comeout of loop and fails it with an log entry "Waited for the files for 30 mins but bow is not avaialble.

HOPE above would help.

Thanks