Running tasks on a schedule
Cron jobs: when they run and what to put in them.
A cron job runs a command for you at set times, such as a script that sends a report every morning.
Make one
- On the Cron jobs page, pick a preset, or fill in Minute, Hour, Day, Month and Weekday yourself. A
*means every one. - Type the command, on one line.
Times are in UTC. Weekday 0 and 7 are both Sunday.
Examples
| Every 5 minutes | */5 * * * * |
|---|---|
| Every day at 03:00 | 0 3 * * * |
| Mondays at 04:00 | 0 4 * * 1 |
A PHP script on your site runs with its whole path:
php /home/username/web/example.com/public_html/script.php
WordPress
WordPress runs its own tasks when someone visits. To run them on time instead, add define('DISABLE_WP_CRON', true); to wp-config.php, and a job every 5 minutes with php /home/username/web/example.com/public_html/wp-cron.php.