Solved

Fire up function on certain time.

Posted on 2004-10-02
4
213 Views
Last Modified: 2011-09-20
I have 3 times of a day in configuration file, and I want to start the same function on that time everyday by my windows service.
How can I accomplish that?
I read the times in string format, for now it is 24h clock format. Is that the best way to have it in config file?

Config file:
      <time1>7:00</time1>
      <time2>13:00</time2>
      <time3>19:00</time3>
0
Comment
Question by:glowas
  • 2
4 Comments
 
LVL 22

Assisted Solution

by:cookre
cookre earned 100 total points
ID: 12210127
The easiest way is to use a one second timer to see if a scheduled time has arrived or been slightly passed.

To avoid too much unneeded checking, upon service load or just after each scheduled event, set the timer interval to the time to wait before the next scheduled event, less a minute or so.  When that amount of time has elapsed, you can put the timer into one second intervals.
0
 
LVL 22

Expert Comment

by:cookre
ID: 12210129
... and don't forget about midnight.
0
 
LVL 5

Assisted Solution

by:Kelmen
Kelmen earned 100 total points
ID: 12215619
You may try just using the Windows Scheduler, which also allow mutilple scheduling. Use it to trigger your console app.

Though there's some limitations in it. The one bugged me most is the status checking mechanism of the Scheduler. You have to work it out instead of relying the Scheduler for proper logging.
0
 
LVL 10

Accepted Solution

by:
123654789987 earned 300 total points
ID: 12215929
Here is a good example of using a windows service with a scheduler

http://www.codeproject.com/csharp/scheduler.asp
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now