Disclaimer: Always test changes in a safe environment and consult the latest documentation for guidance.

Plesk is a powerful web hosting platform that streamlines the management of websites, applications, and server settings. One of its useful features is the ability to create scheduled tasks, allowing you to automate various processes using crontab syntax. This is particularly beneficial for running scripts, backups, or any repetitive command without manual intervention.

What is Crontab Syntax?

Crontab syntax is a format used to schedule tasks in Unix-like operating systems. It consists of five time-and-date fields followed by the command to be executed. Understanding this syntax is crucial for setting up tasks correctly in Plesk.

Prerequisites

  • Access to your Plesk panel.
  • Basic understanding of crontab syntax.

Steps to Add a Scheduled Task in Plesk

    1. Log into Your Plesk Panel.
    2. Navigate to Scheduled Tasks. Go to Domains > example_domain.com > Scheduled tasks or Tools & Settings > Scheduled Tasks.
    3. Click on "Add Task". This option will allow you to create a new scheduled task.
    4. Specify the Run parameter to "Cron style" to use crontab syntax.
    5. Enter the cron-style time syntax in the Run text field. For example:
* */4 * * *

This example runs the task every 4 hours.

    1. Enter the command you want to execute in the Command text field. For example:
/usr/bin/echo "$message"
  1. After filling in the required fields, click the "OK" or "Save" button to create the scheduled task.

Gotchas to Avoid

  • Ensure your command is executable and has the correct permissions.
  • Double-check the crontab syntax to avoid syntax errors that could prevent the task from running.
  • Monitor the execution of your scheduled tasks to ensure they are running as expected.
Did this answer help? 0 People found this helpful (0 Votes)