Plesk for Linux allows you to automate script execution at specific times using scheduled tasks (cron jobs). This guide shows you how to create, manage, and configure scheduled tasks from the Plesk administrator interface.
Background
By default, scheduled tasks created by Plesk users in Plesk for Linux are executed in a chrooted shell, meaning the file system root is converted to the corresponding system user's home directory. This improves security but limits options for Plesk users. You can change the shell settings by going to Tools & Settings > Scheduled Tasks > Settings. For more details, refer to Scheduled tasks shell setting.
How to do it
-
Step 1: View existing scheduled tasks
Go to Tools & Settings > Scheduled Tasks (Cron jobs) to see all scheduled tasks created for every subscription and those created on the server level.
You can arrange tasks by command, subscription, or schedule. The schedule view is useful for troubleshooting server load spikes caused by resource-intensive scheduled tasks. Click on a task's name to change its properties, activate/deactivate it, or run it immediately.
-
Step 2: Create a new scheduled task
Go to Tools & Settings > Scheduled Tasks > Add Task.
-
Step 3: Choose the task type
Select the appropriate task type based on your purpose:
- Run a command: Specify the full path to the executable file (binary files, shell scripts, or batch files).
- Fetch a URL: Specify only the URL; no need to type commands like
curlorwget. - Run a PHP script: Specify the full script path, for example:
/tmp/script.php.
-
Step 4: Configure schedule and settings
Select how many times the task will run and set the desired date and time. The time is in the server time zone by default. To select a different time zone, go to Tools & Settings > Scheduled Tasks > Settings.
You can also set a description for the task, select the system user in whose security context the task will run, and configure notifications.
-
Step 5: Test the task
Click Run Now and wait until the task completes. If the task completes with an error, it will also fail when executed by the scheduler unless you identify and resolve the issue.