Scheduling in Oozie using cron-like syntax

Most Linux distributions include the cron utility, which is used for scheduling time-based jobs. You can schedule Oozie using Cron-like syntax.

Location

Set the scheduling information in the frequency attribute of the coordinator.xml file. A simple file looks like the following example. The frequency attribute and scheduling information appear in bold.

<coordinator-app name="MY_APP" frequency="30 14 * * *" 
start="2009-01-01T05:00Z" end="2009-01-01T06:00Z" timezone="UTC" xmlns="uri:oozie:coordinator:0.5">
   <action>
      <workflow>
         <app-path>hdfs://localhost:8020/tmp/workflows</app-path>
      </workflow>
   </action>
</coordinator-app>

Syntax and structure

The cron-like syntax used by Oozie is a string with five space-separated fields:

  • minute
  • hour
  • day-of-month
  • month
  • day-of-week

The structure takes the form of * * * * *. For example, 30 14 * * * means that the job runs at at 2:30 p.m. everyday. The minute field is set to 30, the hour field is set to 14, and the remaining fields are set to *.

Allowed values and special characters

The following table describes special characters allowed and indicates in which fields they can be used.

Table 1. Special characters
Character Fields Allowed Description
* (asterisk) All Match all values.
, (comma) All Specify multiple values.
- (dash) All Specify a range.
/ (forward slash) All Specify an increment.
? (question mark) Day-of-month, day-of-week Indicate no specific value (for example, if you want to specify one but not the other).
L Day-of-month, day-of-week Indicate the last day of the month or the last day of the week (Saturday). In the day-of-week field, 6L indicates the last Friday of the month.
W Day-of-month Indicate the nearest weekday to the given day.
# (pound sign) Day-of-week Indicate the nth day of the month

The following table summarizes the valid values for each field.

Field Allowed Values Allowed Special Characters
Minute 0-59 , - * /
Hour 0-23 , - * /
Day-of-month 0-31 , - * ? / L W
Month 1-12 or JAN-DEC , - * /
Day-of-week 1-7 or SUN-SAT , - * ? / L #