Click here to Skip to main content
11,428,876 members (62,008 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Scheduler
I need to check a daily log file for errors.   I have created a C# class with one method that checks the file and sends an e-mail with the answer.   I want the system to run this class automatically every night.

Any help would be greatly appreciated.
Posted 5-Oct-11 5:32am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

The easiest an simplest way would be to employ the Windows Task Scheduler[^] service.

Build your class into a console application, then use the Task Scheduler to schedule it. This can be done using the GUI (Control Panel → Administrative Tools → Task Scheduler), or at the command line using at[^] or schtasks[^]. The latter is much more flexible.

If you would like to do this programatically, you want to develop a Windows NT Service[^]. This is a much bigger task.
  Permalink  
v2
Comments
SAKryukov at 5-Oct-11 11:22am
   
Agree, using the Task Scheduler service is probably the best way, my 5.
Writing a whole Windows Service for this task could be a big overkill for this particular problem, good to mention though.
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Create a console app project using your class and schedule it on your server.

Here you will find an guide on how to schedule a task:
http://support.microsoft.com/kb/308569[^]

And here you can start with a creating a console app:

http://msdn.microsoft.com/en-us/library/0wc2kk78(v=vs.90).aspx[^]


Cheers!
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web04 | 2.8.150428.2 | Last Updated 5 Oct 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100