Reputation: 5000
In my ASP.NET MVC 4 project i need to create different job process to be executed at different time interval.I am planning to do that using Windows Task Scheduler.
Since i am new in Task Scheduler i need some help.
My scenario is i need to send email to list of customers at a particular interval. For getting list of Customer details i have web services(which will give all the email-ids of selected customers).These web services are for different types of customers ie: say Customer category A and Category B.
One service is for getting list of email ids of Category A and another for getting list of email ids for Category B.
Both the categories A and B is having different time interval for sending emails(These time intervals are stored in my local DB).
For Running this task i am going to create a Single Console application.Is it possible to run both jobs in a single console application using Task Scheduler.If possible please provide some examples.
Any help is appreciated..
Upvotes: 1
Views: 2008
Reputation: 104559
Assuming this is a server box or a box not directly used as a workstation, my suggestion would be to keep the scheduled task to run at the lowest common denominator between the different intervals. (e.g. schedule the task to run every couple of hours).
The task launches your code at the periodic interval. Your code (or script) then in turn runs "job A" followed by "job B". The code of each job (or perhaps the parent script) decides, "is it time to run or not". If the job has been started too early since the last time it ran, it just exits.
Upvotes: 1
Reputation: 2005
Would it not be better to build a windows service and use a scheduling framework like Quartz.net ?
I feel this is a better way of doing events firing at specified times.
Upvotes: 1