Scheduler Cron Syntax

This topic provides instructions for using Quartz cron syntax with Pivotal Scheduler.

Overview

Pivotal Scheduler uses Quartz cron, a custom form of cron syntax, for scheduling tasks. This format is based on traditional cron syntax.

See the sections below for more information about Quartz cron syntax, requirements, and limitations.

Scheduler Cron Syntax

The following table describes special characters in Quartz cron syntax. You can use these special characters to create scaling rules with Pivotal Scheduler.

* Every
? Any
## Value
#-# Range

For more information about special characters, see Cron Trigger Tutorial.

Examples of Cron Syntax

The following are examples of custom scaling rules with Pivotal Scheduler:

  • Every Hour:

    cf schedule-call my-call "0 * * * ?"
    
  • Every day at 8:30am:

    cf schedule-call my-call "29 8 ? * *"
    
  • Every week at 6pm on Friday:

    cf schedule-call my-call "0 18 ? * 5"
    

For more examples, see Cron Trigger Tutorial.

Quartz Cron Requirements and Limitations

The following are requirements and limitations of Quartz cron:

  • Quartz cron does not support seconds. To convert a traditional Cron expression to Quartz Cron, remove the first value, leaving 5 total values. For example, "0 0 * * * 3" in traditional cron is "0 * * * 3" in Quartz cron.

  • The day of week cannot conflict with the day of the month in the cron expression. Quartz cron requires at least one of the “Day” fields to be non-wild. For example, "* * ? * *" and "* * * * ?" both run the task at the same interval.

  • Day of week starts at 0 for Sunday.