Solved

Fire up function on certain time.

Posted on 2004-10-02
4
214 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

821 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