Question
How can I create or edit a cron job in the cPanel user interface?
Answer
Creating a cron job involves the following steps:
- Login to the cPanel account
- Click on the Cron Jobs icon, which is under the Advanced section (Ask your hosting provider to enable this feature if it is missing)
- Under the Common Settings header, you can select a commonly used rate at which your cron job will run, such as "Once per 5 minutes". This will automatically configure the cron job time setting for you. If you would like to select the time period manually, you are welcome to do so.
- Under the Command header, enter the command that you would like to be run. Below are some examples:
Command-line script (Bash):
# bash /home/cpanelusername/full/path/to/your/bash/script.sh
Perl:
# perl /home/cpanelusername/full/path/to/your/perl/script.pl
Python:
# python /home/cpanelusername/full/path/to/your/python/script.py
PHP:
# /usr/local/bin/php /home/cpanelusername/full/path/to/your/php/script.php
If a specific PHP version is needed, the path to the ea-php version needs to be used:
# /usr/local/bin/ea-phpXX /home/cpanelusername/full/path/to/your/php/script.php
Note: Replace XX with your desired PHP version. For example, for PHP 8.2 use: /usr/local/bin/ea-php82
After a cron job is added, you can edit and delete the cron under the Current Cron Jobs section.
Comments
0 comments
Article is closed for comments.