I created a program who reads tasks (send email/send sms etc) from a database and executes each task on the specific time it should. The program works and executes all the tasks. I am using error handling but I want to take extra precautions so if the program crashes for any reason it will notify me and restart the program automatically and execute the tasks that didn't execute because of the crash. The program runs on windows.
Edit: I'll explain more about how the program works. The program is constantly reading from the sql table and adds reminders to a List that answer this parameters: IsExecuted=False And DateTimeStart is within 1 minute range from DateTime.Now. Once I finished reading the table and added relevant reminders to the list. I execute all the reminders (asynchronously)-> remove them from the list -> and change IsExecuted=True in the sql table so it won't add it again. Once I finish sending all the reminders i repeat this process infinitely.
What is the best way to achieve this goal? How do I create a service/program that not only restart the main program but also checks what reminders should have executed but didn't?
Thanks.