views:

209

answers:

6

I've got about 40 lines of .NET code in a console application that read and RSS feed and store information in a database. I need this code to execute every night for as long as the RSS feed exists (indefinitely). Currently, I just launch the console app. from my home computer.

Because I can't trust myself to remember to do this every night, I somehow need to have this code hosted. I'd like to somehow have this app. or code (it could easily be put in an ASP.NET page codebehind and triggered to execute when the page loads) run automatically without me having to run the console app. manually.

Any ideas?

EDIT: I don't want to run this code from my computer; I can't guarantee my computer will not be hibernating or connected to the Internet every night.

EDIT: Right now I'm thinking spawn a background thread using BackgroundWorker in Application_Start of the global.asax, have it download the RSS feed once a day, and Thread.Sleep() the rest of the time.

+1  A: 

I would suggest just using the 'at' command instead of getting this small app hosted somewhere.

C:\>at /?
The AT command schedules commands and programs to run on a computer at
a specified time and date. The Schedule service must be running to use
the AT command.
Chad Gorshing
I always thought of at as something to use when a job needed to be executed once, for jobs that needed to execute more that once at a specific time (e.g. every night) I used cron (http://linux.about.com/od/commands/l/blcmdl8_cron.htm)
armannvg
+2  A: 

You could use the Windows built-in task scheduler to start the console application.

michael.kebe
-1 this only works if he has console access, usually "hosted environment" means he doesn't.
Neil N
A: 

There was a similar question on serverfault.com on how to to schedule a task to run every morning at 6

armannvg
+1  A: 

Although controversial, Jeff Atwood blogged about how they accomplished this for SO using cache expiration. Check it out at http://blog.stackoverflow.com/2008/07/easy-background-tasks-in-aspnet/.

You could use a similar method and schedule the cache to expire at the time you want the process to kick off.

AJ
A: 

Have you looked at Quartz Scheduler for .NET?

Quoth the tagline: Quartz.NET is a full-featured, open source job scheduling system that can be used from smallest apps to large scale enterprise systems.

Jeffrey Hantin
+1  A: 

Email your webhost. Some managed hosts will set up a scheduled task for you.

They will likely have different policies regarding how to call a scheduled task (i.e. some may require it to be an aspx page and not an EXE)

Neil N