Paolo's Notes

BA by day, sleepy coder by night...

Windows cron

What would be the best way to execute an .NET executable every, say, 3 hours? And how should I build it, as an .aspx with no output? Suggestions are welcome :)

Comments

Oddur Magnusson said:

Windows cron = Scheduled Tasks
# October 20, 2003 1:46 PM

Dave said:

I'm curious, why even think of an .aspx? That's a webpage right? Why not at least do your basic Sub Main() module type WinForm - whatever the equivalent is in .NET?
# October 20, 2003 1:49 PM

Julien CHEYSSIAL said:

Hi Paolo,

Here is a link that may be usefull to you :
http://weblogs.asp.net/ashben/posts/31579.aspx

Hope this helps !
# October 20, 2003 1:52 PM

Addy Santo said:


1. There is a windows scheduler which is specifically designed for the scenario you described.

2. A scheduled task is automated and usually has no UI. So why would you want to require the overhead of going over HTTP through IIS? A console app is as slim as they come and should fit your requirements.

3. If you really need web access (does your task call across servers?) then expose a web service instead of a web page - you get more flexibility with less overhead. AND you can easily reuse that functionality later in other apps.



# October 20, 2003 2:24 PM

Jeff Gonzalez said:

If you really wanted an aspx page that bad, you could use scheduled tasks and start an instance of iexplore.exe and pass the address as a parameter.

I would agree with the other commentor's though, that a console application would provide a much better solution than an aspx page.
# October 20, 2003 2:36 PM

Paolo Marcucci said:

I wasn't in deep love with the aspx idea, it was just something that popped in my mind when I was writing the post :)

But yeah, a console app would definitely be perfect. Thanks guys!
# October 20, 2003 4:06 PM

Christopher said:

What about a Windows Service w/ a timer class in it? That seems like a perfect fit - it runs in the background, and you can set the timer to kick off a job every three hours as you indicated you wanted to do.

just my $0.02
-Christopher
# October 20, 2003 4:33 PM

Wallym said:

Windows Service and a timer. Runs GREAT.

Wally
# October 20, 2003 4:36 PM

Paolo Marcucci said:

I am a bit wary of the Service idea because this app will have to work between tonight (if!) and next friday, 31st. So I didn't want to add services and stuff to a remote server just for 15 days. Is it possible to develop and test as a CLI and then convert it to a service? (darn, I sound like a newbie :) )
# October 20, 2003 4:44 PM

Dave Burke said:

Console Apps are easier to write than web apps. Then use the schedule. I've been doing this for a LONG time and had absolutely NO PROBLEMS. And like I said, easy......
# October 20, 2003 5:26 PM

Elrey Velicaria said:

I created a Web Service (asmx) that goes around the application recycling and uses a timer to make it alive 24 x 7. No need for scheduler, no need for windows timer. It works fine. I used the service to start, stop it, look at status. BTW, the application is a notification app ( much like e-minder). :)
# October 20, 2003 9:43 PM

Brian Desmond said:

I think there is a ThreadTimer or TimerThread class that you can put a thread on a timer too.
# October 21, 2003 10:04 PM

Janus1 said:

Take a look see at this link http://www.kalab.com/freeware/cron/cron.htm

and also
http://cronw.sourceforge.net/

No need to re-invent the invented wheel.
# February 17, 2004 10:26 AM

zhichao hong said:

windows task scheduler is much simpler than Unix cron. For example, there is no apparent way to schedule an hourly task! The pycron pointed by Janus1 is a good one.
# May 15, 2004 5:17 PM

Henrik Erlandsson said:

There is a "new" free application that is called VisualCron. It is easier than the task scheduler and has more functions. It also collects some statistics. You can read more at the product website http://www.visualcron.com


regards / Henrik
# July 18, 2004 4:11 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)