Настройка Расписание задач(cron)
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:
- Log on to your cPanel Interface.
- Go to 'Advanced' section.
- Click on "Cron Jobs".
- Select the specific time from the lists provided.
- 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.
Setup in Plesk Panel
If you are going to create subscription-level task, than you can create cron/windows scheduler task in:
- Log on to your Plesk Panel Interface.
- Go to "Subscriptions" section click "Your Subscription".
- Select "Websites & domains"
- Click on "Show advanced operations"
- Select "Scheduled Tasks"
- 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
Other Plesk versions support only "Run a command" option:
Plesk 12.0
Plesk 11.5
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:
- 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. - 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('http://domain.test/script.aspx')"