In my previous post (http://thinkfirstcodelater.com/blog/?p=3329) I showed you how to delete a table associated with a Windows Azure Mobile Service. In this post I’m going to shift away from working with Windows Azure Mobile Service tables and data and start focusing on schedule jobs. Scheduled jobs allow you define server scripts that are executed either on a schedule you define or on demand.
Once again, just a reminder that I’m using the command line tools on a MacBook Air with OSX (Mountain Lion) installed, and I’m using Google Chrome as my default browser. However, the experience should be identical on Windows and Linux as well.
Open an instance of your command line (Terminal, Bash, Command Prompt, etc.) and type the following:
azure mobile job create -h
As you can see the azure mobile job create command is the command to use when you want to create a job. There are several parameters/options you can use
- servicename, the name of the service you want to create the job for
- jobname, the name of the job
- -i, –interval, the job interval
- -u, –intervalUnit, the unit associated with the interval (can be minute, hour, day, month, or none for on-demand jobs)
- -t, –startTime, time of the first run of the scheduled job, the default is now
For this exercise we’ll create a job that runs every fifteen minutes. Type the following into your CLI, substituting where appropriate:
azure mobile job create -i 15 -u ‘day’ ‘[YOUR MOBILE SERVICE NAME]‘ ‘myFirstJob’
I used the following:
azure mobile job create -i 15 -u ‘day’ ‘zumo-00005′ ‘myFirstJob’
You can verify the command was successful by going to the Windows Azure Management Portal and navigating to the Scheduler portion of your Windows Azure Mobile Service.
In upcoming posts I’ll show you how to do the following:
- List your scheduled jobs
- Modify the script associated with a scheduled job
- Update a scheduled job
- Delete a scheduled job
Did you know you can try Windows Azure for free for 30 days? Just go to http://aka.ms/thecloud and sign up.