Windows Service - run only Once a day

  • Thread starter Thread starter RandyS
  • Start date Start date
R

RandyS

Hello All,

I have a windows service that only need to run once a day to download files
from an AS400 system. What is the best approach for this type of service.

Right now what I have done is to start a thread and calculate the amount of
time until the next time to run Now + 23.59.59.00 then put the thread to
sleep for the timespan.

Is the best way to do this?

I thought about have the thread sleep for short periods and check the time
to see if its time to run.


I may also want to setup a service may need to run every X hours or also.

Any thoughts or suggestion would be greatly appreciated

Thanks

Randy
 
Why set it up as a system service then? Why not just a regular exe and place
it into the system scheduler.
 
Full agreement.

A system servie uses ressources all of the time.

The scheduler is WAY better ressoruce wise if the process just starts
"occasionally".

--
Regards

Thomas Tomiczek
THONA Software & Consulting Ltd.
(Microsoft MVP C#/.NET)
 
schtasks /help

Thomas Tomicek said:
Full agreement.

A system servie uses ressources all of the time.

The scheduler is WAY better ressoruce wise if the process just starts
"occasionally".

--
Regards

Thomas Tomiczek
THONA Software & Consulting Ltd.
(Microsoft MVP C#/.NET)
 
I also have a monitoring system that uses TCPIP sockets. The clients connect
to the service and when it runs it they can see everything that happens. I
might need to look into another way aroung this I guess.

Thanks for your reply

Randy
 
Back
Top