download and process a file by ftp at set intervals, with error handling, rescheduling and status messages

Posted by compound eye on Super User See other posts from Super User or by compound eye
Published on 2011-02-14T10:20:18Z Indexed on 2011/02/14 23:27 UTC
Read the original article Hit count: 205

Filed under:
|
|

I want to download a data file from a remote ftp server to my machine at regular intervals. Once the file is downloaded I want to call another script which will process the file.

My development machine is mac os x, the eventual deployment environment is linux.

What's would be the stock standard way to automate this?

I know I can use cron to schedule curl to download and to run a script that will process the downloaded file at regular intervals, and I know could write a slightly more complex script or an application that would do this and add error handling, rescheduling and sending status emails.

But one of my requirements for this project is to write as little custom code as possible, instead I should try to use standard, tried and true existing tools, and if I do have to write code, to try and write the most straightforward code possible. The reason for this is the code will potentially be installed on a large number of machines, all of which will need to be tweaked, customised and maintained by different people, long after I am gone from the project, so the intention is to use well documented, well supported tools as much as possible.

This seems such a common task, there must be tools and scripts all over the internet, written by people who have carefully considered everything that could possibly go wrong when you need to download and process a file from a remote server at regular intervals, with error handling, rescheduling and sending status messages.

Is that what Expect is for?

What would you recommend?

(the system will be downloading weather prediction data every six hours, so that the system can prepare in the event of bad weather warnings)

© Super User or respective owner

Related posts about shell

Related posts about ftp