Cron is a program which is a task scheduler in UNIX-like operating systems (including Apache server). And, at certain times, it automatically executes tasks.

    To get started, select "Advanced → Scheduled Tasks " from the main page in cPanel.

    file

    In the window that opens, you'll see several sections. The first is email, or more precisely, if you want the system to notify you when the script runs, add your email.

    When the script runs, you will get a message with the result.

    file

    Next is the section "Add a new scheduled task ", where you will be able to configure the script you need to run.

    For example, you need to set the script to run once a day.

    We recommend to run Cron tasks at night, because the total load on the server will be lower.

    For example: You need to run the script at 2 am.

    You choose:

    minute - 00  
    hour - 02  
    The rest - *  
    

    file

    ``[Run command with multiple keys (example for Yii Framework ) :

    /usr/bin/php -c /home/username/public_html/domain/php.ini /home/username/public_html/domain/yii parcer /home/username/public_html/domain/commands/script.php
    

    Full parsing of the command by parameter:

    • /usr/bin/php is the path to the interpreter
    • /home/username/public_html/domain_name/php.ini is the path to the php.ini file (accessible via -c key ), where you can specify limits or additional php parameters.
    • /home/username/public_html/domain_name/yii parcer - full path to yii with command parcer.
    • /home/username/public_html/domain_name/commands/script.php - path to the script.

    Run the command through a particular version of PHP

    example with PHP version 5.3

    /opt/cpanel/ea-php53/root/usr/bin/php /home/username/public_html/domain_name/commands/script.php
    

    example with PHP version 5.4

    /opt/cpanel/ea-php54/root/usr/bin/php /home/username/public_html/domain/commands/script.php
    

    example with PHP version 5.5

    /opt/cpanel/ea-php55/root/usr/bin/php /home/username/public_html/domain/commands/script.php
    

    example with PHP version 5.6

    /opt/cpanel/ea-php56/root/usr/bin/php /home/username/public_html/domain/commands/script.php
    

    example with PHP version 7.0

    /opt/cpanel/ea-php70/root/usr/bin/php /home/username/public_html/domain_name/commands/script.php
    

    example with PHP version 7.1

    /opt/cpanel/ea-php71/root/usr/bin/php /home/username/public_html/domain/commands/script.php
    

    example with PHP version 7.2

    /opt/cpanel/ea-php72/root/usr/bin/php /home/username/public_html/domain/commands/script.php
    

    You can also run node.js/python scripts through cgop.

    Example for node.js

    /opt/alt/alt-nodejs11/root/usr/bin/node /home/username/public_html/domain_name/commands/script.js
    

    example for python

    /opt/alt/python37/bin/python3.7 /home/username/public_html/domain_name/commands/script.py