Andy Green
asked on
Run code from windows service at a particular time
Hi All
Is it possible to run code from inside a windows service at a particular time of day. I'm getting the time to run from a config file, and want to check for a file in a folder at that time.
I think I can do it by running the routine and storing the time, then use a timer to elapse until the next due time, but it would be so much easier to ask it to run at said time.
I cant use the scheduler.
Andy
Is it possible to run code from inside a windows service at a particular time of day. I'm getting the time to run from a config file, and want to check for a file in a folder at that time.
I think I can do it by running the routine and storing the time, then use a timer to elapse until the next due time, but it would be so much easier to ask it to run at said time.
I cant use the scheduler.
Andy
Have a thread that is running for each minute or for each x time. This thread should call the function you have and have a check in your function if the time is the same as your configured time.
ASKER
Still stuck with this, My searches suggest using Thread.sleep, but I cant find any suitable code examples.
Any more thoughts anyone.
Andy
Any more thoughts anyone.
Andy
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You need to handle errors for threading.
ASKER
Thanks
Andy
Andy
Have a look here :http://www.codeguru.com/vb