Page tree
Skip to end of metadata
Go to start of metadata

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.

 

Table of Contents


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 are necessary for creating a custom schedule.

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

 

Break down

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

There are 5 pieces to a cron pattern:

The minute will be anything from 1-59. Hour will be anything from 0-23. Day of Month will allow 1-31. Month will accept 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.

Minute1-59 
Hour0-23 
Day of Month1-31 
Month1-12Jan-Dec (first 3 letters)
Day of Week0-7Sun-Sat (first 3 letters)

 

Choose your 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 would like 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 would like 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 2 hours of the day that you would like 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.


Practice your cron pattern

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.

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

 


Exercises 

Now it’s time to put your skills to work! Schedule the job to run at the following times:
 

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 * * *

or

* 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,15 Nov-Jan *

or

* 0 9 5,15 11-1




  • No labels