Categories

Cron

What is a cron?

A cron is a service that allows a user to automatically execute a script at a specific time.

For example, you can set a particular PHP script to be automatically executed everyday at midnight.

Setup in cPenal

Set up cron jobs through cPanel using this procedure:

  1. Log on to your cPanel Interface.
  2. Go to 'Advanced' section.
  3. Click on "Cron Jobs".
  4. Select the specific time from the lists provided.
  5. You should enter the command to run in the "Command" field.

You should make sure to enter the proper command and the full path to the file.

For example: /user/bin/php/home/user/public_html/cron.php
If you are not sure the command path, you could ask your hosting angency.

Extension Cron Jobs

Extension Cron Jobs

Setup in Plesk Panel

If you are going to create subscription-level task, than you can create cron/windows scheduler task in:

  1. Log on to your Plesk Panel Interface.
  2. Go to "Subscriptions" section click "Your Subscription".
  3. Select "Websites & domains"
  4. Click on "Show advanced operations"
  5. Select "Scheduled Tasks"
  6. There will be only one name of FTP user of your subscription

Pay attention to interface changes for Plesk 11.5 and Plesk 12+ - there is no need to open "Show advanced operations".

The latest Plesk 12.5 provide a lot of options to cover most of the task cases:

The latest Plesk 12.5 provide a lot of options to cover most of the task cases
Extension Cron Jobs

Other Plesk versions support only "Run a command" option:
Plesk 12.0 Extension Cron Jobs


Plesk 11.5 Extension Cron Jobs

If you need just answer, in "Server" -> "Scheduled Tasks" you can choose:

  • FTP user of your subscription mysite.com
  • Your can choose root, but it's not recommended for security reasons.

For Plesk version below 12.5 to schedule execution of PHP script on Windows there is two ways:

  1. Direct call of php binary with your script as argument.
    Path to executable file: C:\Program Files (x86)\Parallels\Parallels Panel\Additional\PleskPHP55\php.exe
    Arguments: path to you script like C:\inetpub\vhosts\domain.tld\httpdocs\script.php
    Note: Pay attention to interpretation path, ...Additional\PleskPHP55\php.exe it path for PHP 5.5, you can change PleskPHP55 to PleskPHP5, PleskPHP53 or PleskPHP54 to use another PHP version.
  2. Call script via request to your site:
    Path to executable file: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
    Arguments: -c "(new-object system.net.webclient).downloadstring('https://domain.test/script.aspx')"