Creating a Scheduled Task
- Log in to Plesk.
- Go to Websites & Domains.
- Click the domain name where you want to create the task.
- Click Scheduled Tasks (under the Advanced section, or search for it in the top bar).
- Click Add Task.
- Configure the task:
- Task type: Select the type of task:
- Run a command: Execute a server command (e.g., a PHP script or shell command).
- Fetch a URL: Visit a specific URL (useful for triggering scripts on your website).
- Run a PHP script: Execute a PHP file on the server.
- Command/URL/Script path: Enter the command, URL, or script path to execute. For example:
- Run a command:
/usr/bin/php /var/www/vhosts/yourdomain.com/httpdocs/cron.php - Fetch a URL:
https://yourdomain.com/cron.php - Run a PHP script:
/var/www/vhosts/yourdomain.com/httpdocs/wp-cron.php
- Run a command:
- Run: Set how often the task should run:
- Cron style: Enter a cron expression (e.g.,
* * * * *for every minute, or0 2 * * *for 2:00 AM daily). - Or use the GUI dropdowns to select minute, hour, day of month, month, and day of week.
- Cron style: Enter a cron expression (e.g.,
- Task type: Select the type of task:
- Click OK or Run Now to save and optionally execute immediately.
Common Cron Expressions
* * * * *— Every minute*/5 * * * *— Every 5 minutes0 * * * *— Every hour0 2 * * *— Every day at 2:00 AM0 0 * * 0— Every Sunday at midnight0 0 1 * *— On the 1st of every month at midnight
Important Notes
- Scheduled tasks run at the server time zone, which may differ from your local time. Contact your hosting provider to confirm the server time zone.
- Incorrect cron expressions can cause tasks to run too frequently, consuming server resources. Always test new tasks first.
- The "Fetch a URL" option is the simplest and safest way to trigger a script on your website.
- Some hosting providers limit the number of scheduled tasks per domain. Contact support if you need more.
Troubleshooting
Scheduled task is not running:
- Check that the task is enabled (not suspended).
- Verify the command, URL, or script path is correct.
- Check the server time zone — the task may be running at a different time than expected.
Script runs but produces errors:
- Check the script output by clicking the task name and reviewing the log.
- Ensure file paths in the command are absolute (full path from server root).
"Maximum number of tasks reached":
- Contact your hosting provider to increase your scheduled task limit.