?
Solved

Fire up function on certain time.

Posted on 2004-10-02
4
Medium Priority
?
218 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 22

Assisted Solution

by:cookre
cookre earned 400 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 400 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 1200 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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!
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

762 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