Script should check for the file ever 15 minutes on the FTP server�if the file is not found, then the whole script exits. File will only be created one a week at random.
i have gotten this far, but am kind of stuck, also sleep command doesnt work in ftp, so looking for the right statement to use (if, then, else, while, etc.) or should it just be done with a cron?, here's what i have so far, until i get stuck:
Can you install software on the machine doing the fetching?
If so ncftp makes this pretty ncftpget does most of the work for you and gives a nice exit status:
Success.
Could not connect to remote host.
Could not connect to remote host - timed out.
Transfer failed.
Transfer failed - timed out.
...
So you can just run:
ncftpget -u $USER -p $PASSWD ftp://$FILE
case $? in
0) echo "All done"
3) echo "File not there yet"
4) echo "Network timeout"
esac
I'd suggest running a script every 15 mins via cron, that checks for the local file and if it hasn't already been fetched it then attempts ncftpget.
It's also worth considering using the ncftpget -DD option to remove the remote file once you have it.