Cron jobs on comprehensive web hosting

It is possible to use cron on the web hosting server, but not on where cron is disabled. To run a cron job, create a file called crontab in the directory <site>/cron on

This file must be named crontab (not e.g. crontab.txt) and must be in Unix file format (LF line endings) rather than DOS/Windows format (CRLF line endings).

The web server will then copy this into place, as this file is synchronised once every 5 minutes.

The  <site>/cron/crontab file should follow the usual syntax for crontab files. An internet search for 'crontab examples' may also provide helpful examples.

N.B. Users are strongly recommended to set an email address where the output of tasks will be sent. This can be done by adding MAILTO=your@email.address to your crontab file; if you do not do this, you will not receive any output from your jobs.

One example of this is to enable the polling of cron jobs on a Drupal site every 15 minutes. To do this (using curl) you would create the file with contents:

# Set recipient email address for task output

# Poll Drupal cron every 15 minutes
15/* * * * * curl --silent -o /dev/null

Note you can also use wget rather than curl to do this.

Service area: 

Written by IT Services. Latest revision 8 June 2017