Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

Dev Guide
Dev GuideUser GuidesGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Schedule jobs using cron expressions

Schedule jobs with cron expressions for an Optimizely Connect Platform (OCP) app,

The following are different ways to trigger OCP jobs:

  • Trigger the job by another part of the app, like a form.
  • Use a cron expression to run the job periodically on a given schedule.
  • Use the following opti-cli command:
    opti jobs trigger <appId> <jobName> <trackerId> 
    

Schedule jobs with cron expressions

Use the cron property in the app manifest file (app.yml) to schedule the regular execution of a job. The property uses quartz cron format.

Examples

ExpressionDescription
- - ? *Every second.
0 _ ? _Every minute.
0 /2 ? * *Every even minute.
0 /2 ? * *Every two minutes.
0 /5 ? * *Every five minutes.
0 /10 ? * *Every 10 minutes.
0 /15 ? * *Every 15 minutes.
0 /30 ? * *Every 30 minutes.
0 15,30,45 ? *Every hour at minutes 15, 30 and 45.
0 0 /2 ? *Every hour.
0 0 0/2 ? * *Every even hour.
0 0 /12 ? *Every 12 hours.
0 0 12 * * ?Every day at noon - 12pm.
0 0 12 ? *SUN Every Sunday at noon.

To build your own cron expression, you can use a free formatter.

The following is an example of a YAML configuration:

jobs:
  nightly_import:
    entry_point: NightlyImport
    # runs at midnight every night
    cron: 0 0 0 ? * *
    description: Performs a nightly import for data that is not provided or needed in real time