Scheduling with Custom Cron Patterns

Using custom cron patterns in your scheduling allows you more flexibility and customizable runs that are more specific than you can make with general scheduling.

In this demo, translate the cron pattern language and get on your way to better scheduling.

Sample Data Download

Download: The Flight Delays app from the Datameer App Market.

This demo includes an app download because an import job, data link, or workbook is necessary for creating a custom schedule.

File uploads can't be scheduled. The application can be found under the App Market tab in your Datameer application.

Breaking Down Cron Patterns

In order to schedule with custom cron patterns, you must first understand what the combination of (wild cards) and numbers mean in the pattern.

There are 5 pieces to a cron pattern:

The minute is anything from 1-59. Hour is anything from 0-23. Day of Month allows between 1-31. Month accepts 1-12 or names (first 3 letters of month name). Day of Week is Sunday through Saturday 0-7 (0 or 7 represents Sunday).

You can also use the first three letters in Day of Week. The * represents first-last, or all.

1Minute1-59
2Hour0-23
3Day of month1-31
4Month1-12Jan-Dec (first 3 letters)
5Day of week0-7Sun-Sat (first 3 letters)

Choosing A Schedule

Now that you have an understanding of how a cron pattern is broken down, you need to decide on a schedule.

For example, if you want to run a job Monday through Friday every week at 4:05 PM every month:

The 5 represents the 5th minute of the hour, the 16 represents 4 PM. The ** calls all days of month and all months. The 1-5 calls Monday through Friday.

You can also write it like this:

Now we can get more advanced. Say you want to run a job at 10 AM and 6 PM, but only on the 1st and 15th of each month:

The 10 and 18 represents the two hours of the day that you want to run the job. The 1 and 15 represents the days of the month. The ** tells the job to run every month on any day. You can use the - or , to separate values in your cron pattern as we have in the past 2 examples.

Practicing Cron Patterns

Now that you have learned the the basics of cron patterns, let’s practice! Navigate to where you have the Flight Delays application installed in Datameer. Navigate to the Resources folder within the app and right-click the Airports import job > Configure. (As of v6.3, click Open.)

Click Next until you come to the Schedule tab and select On a schedule under Loading and you see the Cron Pattern field box.

 

Exercises

Now it’s time to put your skills to work! Schedule the job to run correctly in the following exercises. 

Exercise one

You would like to run your job at the top of the hour from 9 AM to 6 PM every day.


 Answer

0 9-18 * * *

Exercise two

You would like to run your job at 15 after the hour at 11 AM and 11 PM Monday through Friday.


 Answer

15 11,23 * * Mon-Fri

or

15 11,23 * * 1-5

Exercise three

You would like to run your job at 9 AM on the 5 and 25th of November, December, and January.


 Answer

0 9 5,25 Nov-Jan *

or

0 9 5,25 11-1 *