开发者

Mimic Windows Task Scheduler with code

开发者 https://www.devze.com 2023-03-06 14:54 出处:网络
I\'m looking for a way to make a program that runs itself (or a method) every X time (days, weeks, whatever). Basically, I want my program to do what the Windows Task Scheduler could do. The reason I

I'm looking for a way to make a program that runs itself (or a method) every X time (days, weeks, whatever). Basically, I want my program to do what the Windows Task Scheduler could do. The reason I don't use the Task Scheduler is because I plan to deploy this applicat开发者_如何学运维ion on a server which I have no remote access to, but need to re-generate some files every given time.

Suggestions?


You could use Quarts.net:

http://quartznet.sourceforge.net/


You can just run a program as a service, it can have a Timer that is executed on the schedule you need. Topshelf is a simple service host for .NET that could you generate that service. I think the sample service provided does just that at a small interval.


Create a Windows Service and use a timer. You can pick between System.Timers.Timer and System.Threading.Timer based on the differences you can find here:

http://www.intellitechture.com/System-Windows-Forms-Timer-vs-System-Threading-Timer-vs-System-Timers-Timer/

0

精彩评论

暂无评论...
验证码 换一张
取 消