views:

50

answers:

1

I have a script running on windows box that downloads files from the net via http. I want it to download only from 1am - 8am (my ISP's off peak time). I am happy if already started download finishes after 8am but what is the best method to make sure that the script starts downloading after 1am? I want to run the script and go to sleep. I want to use ruby only.

Is sleep the best way how to do it?

+1  A: 

There is a good article on this here: Scheduling tasks in Ruby / Rails

But as someone else mentioned, you should use the windows task scheduler to start your script. Unless you really want to start it manually at 1am and every time you reboot your windows box... See this other SO question on how to add a scheduled task using the AT DOS command: http://stackoverflow.com/questions/132971/what-is-the-windows-version-of-cron

esavard