In part 3, you learnt more about setting schedules for jobs using the schedule check boxes. In this part, I am going to show you more possibilities for setting the schedule.
Open the scheduler dialog box. If you have forgotten how to do so, review part 3 again. This time I want to bring your attention to the area just below the check boxes for the schedule. There is a text box labelled Advanced which is also a drop down list followed by a Change button.
Let us look at the drop down list first. Click on the down arrow at the end of the Advanced text box to open the list. I have added some useful schedules to the list.
Choose a schedule from the list, say Every Tue,Wed at 1:00pm and click the Change button. The schedule should change to this.
How about every Monday, Wednesday and Friday at 2pm? There is no item in the list that matches this. But you can actually type something in the text box that does this. Try every mon,wed,fri at 2:00pm and click the Change button. Be careful with the spaces, they are important.
Here are some examples you can try out yourself.
every 10 mins
every 3 hours at 0 mins
every weekday at 15
every day at 9
Sunday at midnight
You get the idea. The natural language processor I created understands many common ways of specifying the schedule. It is not perfect, but will often get your job done.
Unix like systems have a very powerful expression for specifying schedules called cron expressions. I have also implemented something similar which I creatively call cron-like expressions. They are a different from cron expressions, so watch out if you already understand cron expressions.
You can also set a schedule by specifying a string of three components separated by a space. The first component specifies the Day, the second component specifies the Hour and the third component specifies the Minute.
As an example, you can use the following:
0 0 0
This is a cron-like expression that says Sunday at midnight. Here is what it means.
The first component 0 stands for the Day where 0 is Sunday, 1 is Monday and so on until 6 which is Saturday.
The second component 0 stands for the Hour where 0 is midnight, 1 is 1 am and so on until 23 for 11 pm.
The third component 0 stands for Minute where 0 is 0, 1 is 5 minutes, 2 is 10 minutes and so on until 11 for 55 minutes.
Try the following examples to make things clear. Remember to click the Change button to apply your schedule.
Sunday 5:00 am: 0 5 0
Friday 5:30 pm: 5 17 6
Here is where thing start getting interesting. You can also separate multiple values for each component. To set a schedule for every weekend at 8 am here is what you can give.
0,6 8 0
Here are some more examples to try out.
Mon, Wed, Fri at 10:00 am and 6:00 pm: 1,3,5 10,18 0
Every 15 mins on Tue, Thu at midnight: 2,4 0 0,3,6,9
You can also use a – to separate two numbers to specify a range. For example, in the Hours component, you can specify 1-5 to specify 1,2,3,4,5. Here are some examples to try it out.
Every hour on weekdays from 10 am to 5 pm: 1-5 10-17 0
Every 5 mins on weekdays from 10 am to 5 pm: 1-5 10-17 0-11
You can combine – with , in any component as many times as you like. Think of some examples yourself. Here is a single example as a reference. 1-3,6 0-3,21-23 0
Powerful enough? There is more. You can also use a * in a component to mean every possible value or a */n to mean every nth value. Here are some examples you can try out.
Every 5 mins: * * *
Every weekday every 15 mins: 1-5 * */3
Every other day every two hours: */2 */2 0
Remember that after you click the Change button, the cron-like expression you specify should get applied and will be cleared from the text box. If it does not, then there is probably something wrong with the expression. The most common error I have seen is trying to put spaces in the component.
In this part, you saw more ways to set the schedule. In part 5, we will see other parts of the Scheduler dialog box.