Cron Jobs

Travis CI cron jobs work similarly to the cron utility; they run builds at regular scheduled intervals independently of whether any commits were pushed to the repository. Cron jobs always fetch the most recent commit on a particular branch and build the project at that state. Cron jobs can run daily, weekly or monthly, which in practice means up to an hour after the selected time span, and you cannot set them to run at a specific time.

Configure cron jobs from the “Cron Jobs” settings tab on your Travis CI page.

settings page with cron section

If your API or cron triggered builds run on the same commit or branch over and over again, you will notice GitHub has a limit of 1000 status updates per commit, which causes the Travis CI build status to display incorrectly on GitHub. Avoid this problem by specifying a regularly updated branch for your automated builds.

Adding Cron Jobs #

Select the branch to run the build on, how often to run the build, and whether to run the build if there was a build in the last 24 hours, then click “Add”:

adding a cron job

Confirm that the cron job is displayed in your settings tab:

cron job created

Skipping Cron Jobs #

Please note that cron jobs will run regardless and cannot be skipped even with [ci skip] in the latest commit message.

Deleting Cron Jobs #

Click the small trash icon on the right hand side of the page:

deleting a cron job

Detecting Builds Triggered by Cron #

To check whether a build was triggered by cron, examine the TRAVIS_EVENT_TYPE environment variable to see if it has the value cron.

Notifications #

Cron job builds use the same notification settings as normal push builds.