Cron jobs on the comprehensive web hosting service

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

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 sitename.ox.ac.uk/cron/crontab with contents:


# Set recipient email address for task output

 

MAILTO='first.last@unit.ox.ac.uk'

 

# Poll Drupal cron every 15 minutes

 

15/* * * * * curl --silent -o /dev/null http://site.ox.ac.uk/cron.php


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

Get support


Local IT support provide your first line of on-the-spot help

FIND MY LOCAL IT TEAM

 

Common requests and fault reports can be logged using self-service

   USE IT SELF-SERVICE    

   LOG A SUPPORT CALL    

VIEW MY SUPPORT CALLS  

The central Service Desk is available 24x7 on +44 1865 6 12345

 

If you do not have an SSO account you can use this form to contact the Service Desk