Link to home
Start Free TrialLog in
Avatar of Andy Green
Andy GreenFlag for United Kingdom of Great Britain and Northern Ireland

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
Avatar of Paul Jackson
Paul Jackson
Flag of United Kingdom of Great Britain and Northern Ireland image

You can write your own windows service using vb.net

Have a look here :http://www.codeguru.com/vb/gen/vb_system/services/article.php/c4825
Avatar of srikanthreddyn143
srikanthreddyn143

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.
Avatar of Andy Green

ASKER

Still stuck with this, My searches suggest using Thread.sleep, but I cant find any suitable code examples.

Any more thoughts anyone.

Andy
ASKER CERTIFIED SOLUTION
Avatar of srikanthreddyn143
srikanthreddyn143

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You need to handle errors for threading.
Thanks

Andy