How to schedule a task in Plesk for Linux?
There are two types of scheduled tasks in Plesk:
- Customer scheduled tasks. This type of tasks can be created by both Customers and Administrators. They are executed on behalf of a system user. Such tasks do not provide access to the filesystem outside of the document root of the web site.
- Administrator scheduled asks. This type of tasks can be created by Administrators only. They are executed on behalf of the root user. Such tasks provide write access to the whole filesystem.
Click on a section to expand
How to schedule a Customer scheduled task from Plesk UI:
How to schedule an Administrator scheduled task from Plesk UI:
- Log in to Plesk
- Go to Tools & Settings > Scheduled Tasks > Add Task.
- In the Command field, put the full path to the script to be executed.
- In the Run field, set the the task execution time.
- In the System user field, leave user as root or choose another system user to run the task:
- Click OK to save changes.
How to create/edit scheduled task from the command line, SSH with a system user account:
How to create/edit the scheduled task from the command line, SSH with “root” account:
- Connect to the server via SSH
- Run the following command to open crontab editor for a specific user:
Replace johndoe with the desired username.
# crontab -e -u johnoe
Type in the cron task parameters, using cron file syntax. For example:
* * * * * /bin/echo “test” > /tmp/testfile
Plesk documentation: Scheduling tasks
To do it through CLI (Command line interface), the crontab system utility can be used: crontab(1) — Linux manual page