How to Schedule a Task in Plesk for Linux?
Some Linux server maintenance tasks, such as database backups, log rotations, and cache clearings, need to be performed automatically. In Plesk, such tasks are managed via Scheduled Tasks, which act as a more simplified layer over a system’s crontab. With Plesk you won’t have to spend time figuring out which command line you need to use to run a PHP script, execute a system command, or pull a URL. This way, you can ensure vacuums on your website are being performed while you are doing more meaningful development work.
Steps to Schedule a Customer Scheduled Task via Plesk UI:
1. Login to Plesk.
2. Go to Websites & Domains > example.com > Scheduled Tasks > Add Task.
3. In the Command text box, input the absolute path to the script to be executed.
4. In the Run box, set the schedule to execute the task (check an example here).
5. To save the adjustments, click OK.
Steps to Schedule an Administrator Scheduled Task via Plesk UI:
1. Login to Plesk.
2. Go to Tools & Settings > Scheduled Tasks > Add Task.
3. In the Command text box, input the absolute path to the script to be executed.
4. Specify the duration for task execution in the Run field.
5. In the System user field, either keep the user as root or select a different system user to execute the task.
6. Hit OK to confirm and save changes.
Steps to Create/Edit Scheduled Task from the Commands Line, SSH with a System User Account:
1. Access Plesk.
2. Allow the customer to establish an SSH connection to the server at Plesk > Subscriptions > example.com > Web Hosting.
3. Go to and select Access to the server over SSH.
4. Log in to the server via SSH with a system user account.
5. Execute the following command to access the crontab editor:
crontab -e
Steps to Create/Edit the Scheduled Task from the Command Line, SSH with “root” Account:
1. Establish an SSH connection to the server.
2. Use the command below to access the crontab editor for a specified user:
3. Substitute johndoe with the username of your choice.
crontab -e -u johnoe
4. Type the cron task parameters using the cron file syntax. For example:
* * * * * /bin/echo “test” > /tmp/testfile
Conclusion
Task scheduling in Plesk for Linux is a brilliant way to merge effective automation with simplicity. Automating periodic upkeep to the server’s internal clock reduces the chances of mistakes and keeps your apps running at their best at all times. As you start adding tasks to the list, don’t forget to keep an eye on the execution logs to identify and resolve problematic scripts as quickly as you can. Now that your automation is complete, your server is working harder for you!