Automating routine operations is crucial for efficient server management. If you need to execute scripts or commands on your server at predefined intervals or specific times, the task scheduler facility in Plesk Obsidian provides a robust and convenient solution, allowing the system to automatically run these tasks for you.

Viewing and Managing Scheduled Tasks

To gain a comprehensive overview of all scheduled tasks, whether created for individual subscriptions or at the server level, navigate to Tools & Settings > Scheduled Tasks (Cron jobs). This central location offers a consolidated view of all automated processes running on your server.

Plesk Scheduled Tasks Interface

The interface allows for efficient task management and troubleshooting. You can sort tasks by command, by subscription, or by their schedule. Sorting by schedule is particularly useful for identifying potential performance bottlenecks; for instance, a sudden spike in server load might be attributed to a resource-intensive scheduled task running at a specific time. For each task listed, you have the flexibility to:

  • Modify its properties by clicking on the task's name.
  • Activate it using the Activate Task Icon icon.
  • Deactivate it via the Deactivate Task Icon icon.
  • Manually run the task immediately for testing or urgent execution.

Important Note for Plesk for Linux Users: By default, scheduled tasks initiated by Plesk users are executed within a chrooted shell environment. This means the file system root is temporarily shifted to the corresponding system user’s home directory. While this measure significantly enhances server security by isolating user environments, it also imposes certain limitations on the user's operational scope. Server administrators have the option to modify the shell used for scheduled tasks across all Plesk users by accessing Tools & Settings > Scheduled Tasks > Settings. For a more in-depth understanding of these shell configurations, please refer to the Scheduled tasks shell setting documentation.

Creating a New Scheduled Task

To set up a new automated process, navigate to Tools & Settings > Scheduled Tasks > Add Task. The first step involves selecting the appropriate task type, which dictates how the task will be executed based on your specific requirements:

  • Run a command: This option is ideal for executing binary files, shell scripts, or batch files. You will need to provide the full, absolute path to the executable file on your server. This is a versatile option for various system-level operations.
  • Fetch a URL: If your task involves triggering an action by accessing a web address, simply specify the URL. Plesk handles the underlying HTTP request automatically, eliminating the need to manually input commands like curl or wget. This is perfect for webhooks or external API calls.
  • Run a PHP script: For executing PHP-based operations, specify the complete path to your PHP script, such as /tmp/script.php. Plesk will ensure the script is run in the correct PHP environment.

Configuring Task Schedule and Properties

Once the task type is selected, you will need to define its execution frequency and specific timing. You can set how often the task will run, along with the precise date and time. By default, the task's schedule adheres to the server's time zone. If your operational needs require a different time zone for task execution, you can adjust this setting under Tools & Settings > Scheduled Tasks > Settings. Additionally, the task configuration allows you to:

  • Provide a clear and descriptive name or description for easy identification and management.
  • Select the specific system user under whose security context the task will be executed. This is vital for controlling permissions and ensuring the task has the necessary access rights without compromising security.
  • Configure notification preferences, allowing you to receive alerts upon task completion or failure.

Testing Your Scheduled Task

Before finalizing and saving your new scheduled task, Plesk offers a crucial functionality: the option to perform a test run. Clicking Run Now allows you to execute the task immediately and observe its behavior. It is highly recommended to utilize this feature to verify that the task is configured correctly and functions as expected. If the test run concludes with an error, it is imperative to identify and resolve the underlying issue before relying on the scheduler. A task that fails during a manual test run will inevitably fail when automatically executed by the system, potentially disrupting your server operations.

By effectively using the scheduled tasks feature in Plesk Obsidian, you can significantly enhance server automation, streamline routine maintenance, and ensure your applications and services run smoothly and reliably.

Was this answer helpful? 0 Users Found This Useful (0 Votes)