Scheduled tasks (cron jobs) run something automatically at set times — a CMS's own scheduler, a cleanup script, a data import. They are managed in the scheduled tasks section of the panel.
Adding or editing a task
Use the add button on the scheduled tasks overview page to create a task, or the edit icon next to an existing one to change it.
The fields
- Is enabled? — tick to activate the task. Useful for switching a job off temporarily without losing its configuration.
- Task type — one of three:
- Execute command — runs a console command or script;
- Call URL — requests a URL. The call counts as successful if the address answers with HTTP status 200;
- Execute PHP script — runs a PHP file.
- Command — for "Execute command": the command or script to run.
- URL — for "Call URL": the address to request.
- PHP script path — for "Execute PHP script": the full path to the file. A relative path will not work.
- PHP interpreter — for "Execute PHP script": which PHP version to run it with. Choose the same version the site itself uses, or the script may behave differently from the way it does on the site.
- Description — a note to tell several jobs apart. Worth filling in; a list of unlabelled cron jobs is unpleasant to inherit.
Schedule
Choose the interval from the drop-down menu:
- Hourly — specify the minute past the hour;
- Daily — the time of day;
- Weekly — the day of the week and the time;
- Monthly — the day of the month and the time;
- Yearly — the date and time;
- Cron style — enter the schedule in cron syntax, for anything the preset intervals do not cover.
Avoid scheduling everything at midnight or on the hour. If several jobs and a backup all start at once, they compete for the same processor and disk, and a task that normally takes seconds can take minutes.
Notifications
- Never — no messages.
- On errors — a message when the job fails. Note the mechanism: a notification is only sent if the script writes to standard error (stderr). A script that reports a problem to standard output, or simply exits, will not trigger anything.
- Always — a message on every run.
- Email address — where these messages go. Required for the last two options.
On errors is the sensible default. Always is useful for a few days after setting up a new job, to confirm it really runs — then switch it back, or the messages become noise you stop reading.
WordPress and similar CMS schedulers
Many content management systems have a built-in scheduler that only runs when someone visits the site. On a quiet site that means scheduled publishing and maintenance happen late or not at all. The usual fix is to disable the built-in mechanism and call it from a real cron job here instead.
If a task does not run
Check that it is enabled, that the path is absolute, and that the PHP interpreter matches the one the site uses. Set notifications to Always temporarily to see what the job actually reports.
If it still does not work, open a ticket from your client area with the task description and what it is supposed to do.