Articles in this section

How to schedule a task in Plesk for Linux?

kb: how-to Plesk for Linux ABT: Group B

Applicable to:

  • Plesk for Linux

Question

How to schedule a task in Plesk for Linux?

Answer

There are two types of scheduled tasks in Plesk:

  • Customer scheduled tasks. These types of tasks can be created by both Customers and Administrators. They are executed on behalf of a system user. Such tasks do not provide access to the filesystem outside of the document root of the website.
  • Administrator scheduled tasks. This type of tasks can be created by Administrators only. They are executed on behalf of the root user. Such tasks provide write access to the whole filesystem.

Click on a section to expand

How to schedule a Customer scheduled task from Plesk UI:

  1. Log in to Plesk
  2. Go to Websites & Domains > example.com > Dashboard > Scheduled Tasks > Add Task.
  3. In the Command field put the full path to the script to be executed.
  4. In the Run field set the the task execution time (an example is available here).
  5. Click OK to save changes.

How to schedule an Administrator scheduled task from Plesk UI:

  1. Log in to Plesk
  2. Go to Tools & Settings > Scheduled Tasks (Cron jobs) > Add Task.
  3. In the Command field, put the full path to the script to be executed.
  4. In the Run field, set the the task execution time.
  5. In the System user field, leave user as root or choose another system user to run the task:
    mceclip0.png
  6. Click OK to save changes.

 

How to create/edit scheduled task from the command line, SSH with a system user account:

  1. Log in to Plesk
  2. Allow the customer to connect to the server via SSH on the page Plesk > Subscriptions > example.com > Web Hosting Access and allow Access to the server over SSH.
  3. Connect to the server over SSH with a system user account.
  4. Run the following command to open crontab editor:

    # crontab -e

How to create/edit the scheduled task from the command line, SSH with "root" account:

  1. Connect to the server via SSH
  2. Run the following command to open crontab editor for a specific user:
    Replace johndoe with the desired username.

    # crontab -e -u johnoe

  3. Type in the cron task parameters, using cron file syntax. For example:
    * * * * * /bin/echo "test" > /tmp/testfile

Additional information

Plesk documentation: Scheduling tasks

To do it through CLI (Command line interface), the crontab system utility can be used: crontab(1) — Linux manual page

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.