Tutorials • Plesk
Adding a Scheduled Tasks (a scheduled command - CRON JOB) in Plesk
Learn how to add a Scheduled Task (cron job) in Plesk, setting up automated commands to run at specified intervals. Step-by-step guide included.
1
Views 213Updated 20 zilePublished on 16/07/2021by Alexandru Jurca
Introduction
- A Scheduled Task / cronjob represents a command that is executed at a certain time interval.
- The commands used below are examples.
Requirements
- For this, you will need a Plesk account.
Steps
- After logging into the panel Plesk, we will click in the box on the right on the Scheduled Tasks button, which will take us to the respective page.
- Here we have the option to add a task / cron job, refresh the list, delete, or, through the Settings button, change the time zone that the application will take into account when executing commands.
- If we click on Add Task, we will reach the menu where we actually set the task / automated cron job from the Task Type button, which can be of 3 types, as follows:
- First, we will need to choose the domain on which we want to set the task / cron from the Webspace button
- 1. Run a command - This option allows us to run an executable file by providing the absolute path to it or by specifying a command for execution before passing the absolute path to that file in the Command box.
- 1.1 Run - Here we can choose the frequency with which that command will run.
- 1.2 Description - We can pass a description of the order.
- 1.3 Notify - We choose whether we want to receive a notification in case of any error or every time the command runs successfully.
- 1.4 Send notification to - Here we will enter the email address to which we want to send the respective notification.
- 2. Fetch a URL - This option allows us to specify a direct link/URL for the command. There is no need to specify the command itself to execute that link like curl or wget.
- Steps 1.1 - 1.4 apply here as well.
- 3. Run a PHP script - This option allows us to run a PHP script from the current account's directory structure by providing the absolute path of the file and, if needed, the necessary arguments in the next box. Here we can use the icon
to manually choose the file. Also, here we will be able to choose the PHP version we want to run that script with the Use PHP Version button.
- Steps 1.1 - 1.4 apply here as well.