A cron job runs a command or PHP file automatically at set intervals. For example, it can take a backup every night, process an email queue every 15 minutes or run WordPress tasks.
Creating a scheduled task in Plesk
- Log in to your Plesk panel at
https://yourdomain.com:8443or from the service page in your client area. - On the Websites & Domains page, click Scheduled Tasks.
- Click Add Task and choose the task type: Run a PHP script, Fetch a URL or Run a command.
- Enter the file path or address and choose how often it runs.
- Click OK. You can test it right away with Run Now.
How to read the time expression
The five fields are, in order: minute, hour, day of month, month and day of week.
| Expression | Meaning |
|---|---|
*/15 * * * * | Every 15 minutes |
0 * * * * | Every hour, on the hour |
0 3 * * * | Every day at 03:00 |
0 9 * * 1 | Every Monday at 09:00 |
Tip for WordPress
WordPress's own scheduler (wp-cron) runs on every page load and can slow the site. Add define('DISABLE_WP_CRON', true); to wp-config.php and create a task in Plesk that runs wp-cron.php every 15 minutes. Details: Tips on wp-cron.php.
Running tasks too often (such as every minute) can use up your account's resource limits.
