Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does each azure instance run cron?

I am developing an ASP.NET application, which will be uploaded on Azure. If I have multiple instances on Azure and I want to run a cron job that will be necessary for my application. Then, I just want to confirm if that cron job will be run only one time or each instance will run that cron by itself?

For example: If I have 4 instances of cloud service on Azure and my application runs a cron job every day at 11:00 PM. So, I just want to confirm if that cron will be run only one time or each instance will run that cron on its own (i.e. cron will be run 4 times or we can say one time by each instance)?

Please suggest.

like image 415
atul Avatar asked Apr 06 '13 11:04

atul


1 Answers

So far I've found 3 ways to do cron jobs BUT they all require some level of managing the multiple instances possibly running the tasks.

The choices I've used so far:

  1. Windows Task Scheduler - create a startup script that adds the user and task the schedules it. More information here: Running Azure startup tasks as a real user and here: Building a Task Scheduler in Windows Azure

  2. Using Quartz.Net - this I started with, but then moved to the windows task scheduler, but it may work for you since you can customize stuff easier. More information here: Using Quartz.net to Schedule Jobs in Windows.Azure Worker Roles

  3. Using the new job scheduler in Mobile Services. I have not used this one, but when I read this blog: Job Scheduling in Windows Azure late last year I put it on my mental list to look at next time I need a job scheduler. It's still a little new, but it also may help you.

like image 166
Jason Haley Avatar answered Oct 18 '22 09:10

Jason Haley