• Thursday, November 20, 2025

Understanding and Setting Up Scheduled Tasks (Cron Jobs) in Plesk

This guide provides a comprehensive walkthrough on establishing scheduled tasks, commonly known as cron jobs, within your Plesk hosting environment. Cron jobs are powerful automation tools that enable you to execute commands or scripts automatically at predetermined times or intervals. This functionality is invaluable for a wide range of administrative and operational tasks, ensuring your website and applications run smoothly and efficiently.

Common applications for leveraging cron jobs include:

  • Automating routine website backups to protect your data.
  • Executing essential maintenance scripts, such as database optimization or log rotation.
  • Scheduling the dispatch of automated emails for newsletters, notifications, or transactional purposes.
  • Regularly updating website content or synchronizing data with external services.
  • Managing temporary files and ensuring system cleanliness.

Let's proceed with the detailed steps to configure your cron jobs effectively in Plesk.

Step-by-Step Guide to Creating a Cron Job in Plesk

  1. Access Your Plesk Panel: Begin by logging into your Plesk panel. This is typically done by navigating to a URL such as https://yourdomain.com:8443 or a similar address provided by your hosting provider. Enter your designated Plesk username and password to gain access.
  2. Navigate to Tools & Settings: Once logged in, locate and click on the "Tools & Settings" option in the left-hand navigation menu. This section consolidates various administrative utilities.
  3. Select Scheduled Tasks (Cron Jobs): Within the "Tools & Resources" grouping on the "Tools & Settings" page, find and click on "Scheduled Tasks (Cron Jobs)". This will take you to the interface for managing all automated tasks.
  4. Initiate a New Task: On the "Scheduled Tasks" page, you will find an "Add Task" button, usually positioned at the top. Click this button to begin configuring a new scheduled task.
  5. Configure Task Details: A form will appear, prompting you to define the specifics of your scheduled task. Carefully review and complete each of the following fields:
    • Task type: This crucial selection determines how your task will be executed. Choose the option that best suits your requirements:
      • Run a Command: This option allows you to execute a system-level command directly. It's frequently utilized for running scripts written in various languages like PHP, Python, or custom shell scripts.

        Command Field: If "Run a Command" is selected, you must enter the full, absolute path to the command or script you wish to execute, along with any necessary arguments or parameters. For instance, to run a PHP script named backup.php situated in the httpdocs/scripts directory, an example entry might be:

        /opt/plesk/php/*/bin/php /var/www/vhosts/yourdomain.com/httpdocs/scripts/backup.php
        It's important to note that the exact path to the PHP interpreter (e.g., /opt/plesk/php/*/bin/php) can vary based on your specific Plesk version and server configuration. If you are uncertain about the correct path, consult your Plesk PHP settings or contact your hosting provider's support team for clarification.
      • Fetch a URL: This task type instructs the system to access a specified web address (URL). This is useful for triggering web-based scripts or API endpoints.

        URL Field: When "Fetch a URL" is chosen, provide the complete URL that the system should visit.

      • Run a PHP script: Specifically designed for executing PHP scripts located within your hosting account. This provides a direct method for running PHP-based automation.

        PHP script path: If "Run a PHP script" is selected, enter the relative or absolute path to the PHP script you intend to schedule. For example, /tmp/script.php. You also have the flexibility to include any additional arguments required by your PHP script in a separate field.

    • Run Schedule: This section is where you define when your task will run. Plesk offers both predefined intervals and a highly customizable cron-style scheduling:
      • Predefined Options: For common scheduling needs, you can select user-friendly options such as "Daily", "Weekly", "Monthly", or specify a precise time of day for execution.
      • Cron Style: For advanced scheduling requirements, "Cron style" provides granular control using standard cron syntax. This format allows you to specify minutes, hours, days of the month, months, and days of the week.

        Cron syntax consists of five asterisks, each representing a time unit: * * * * *
        (minute) (hour) (day of month) (month) (day of week)

        Here are some illustrative examples of cron expressions:

        • To execute a script every hour, on the hour: 0 * * * *
        • To run a script daily at 3:00 AM: 0 3 * * *
        • To execute a script every Monday at 6:00 PM: 0 18 * * 1 (where 0=Sunday, 1=Monday, etc.)
        • To run a script at 15-minute intervals (e.g., 0, 15, 30, 45 minutes past the hour): */15 * * * *
        • To run a script on the 1st and 15th of every month at midnight: 0 0 1,15 * *
        Understanding cron syntax allows for highly flexible task scheduling.
    • Description: It is highly recommended to add a concise yet informative description of the task. This serves as a useful reference for you and other administrators, making it easier to understand the purpose of each scheduled task.
    • Run this task as: This setting determines the system user under which the scheduled task will be executed. For security and operational consistency, it is generally best practice to run tasks under the "system user" associated with the specific website subscription.
    • Notify on task completion: For monitoring purposes, you have the option to provide an email address. Notifications will be sent to this address upon the task's successful completion or in the event of a failure, helping you stay informed about your automated processes.
  6. Save Your Scheduled Task: After meticulously configuring all the task details, click the "OK" button to save your new scheduled task.

Managing Your Scheduled Tasks

Upon saving, your newly configured cron job will be added to the comprehensive list of scheduled tasks within your Plesk panel. From this list, you retain full control to edit, pause, or remove tasks as required, allowing for dynamic management of your automation.

Should you encounter any challenges during the setup process or have unique scheduling requirements, please do not hesitate to reach out to your hosting provider's support team for expert assistance. They can provide specific guidance tailored to your server environment.