NOTE: If your script does not generate any output, it is possible that notification emails are not sent either, however, the cron job is working.
In order to set up a cron job, go to cPanel > section Advanced > Cron Jobs menu:


General cron job format is as follows:
[path to environment] [Path to script] [Script parameters]
For example, if you want to run a PHP script located in the public_html directory, the correct cron command will be:
/usr/local/bin/php /home/cPaneluser/public_html/yourscript.php
/usr/bin/php -q /home/cPaneluser/public_html/yourscript.php (for business servers)
or if you want to use a relative path (different commands are divided by “;”):
cd /home/YourcPuser/public_html/; /usr/local/bin/php yourscript.php
cd /home/YourcPuser/public_html/; /usr/bin/php -q yourscript.php (for business servers)
For Python and Perl scripts, there is no need to use a full path to the environment, the environment interpreter directive will be enough on shared servers.
python /home/YourcPuser/public_html/yourscript.py
perl /home/YourcPuser/public_html/yourscript.pl
Alternatively, you can just use curl request as the cron job command for the same purpose:
curl “http://yourdomain.com/script.php?argument1=arg1&argument2=arg2” curl “http://yourdomain.com/script.py” curl “http://yourdomain.com/script.pl”
However, unlike the first method, curl-based cron jobs will work only if URLs specified in curl requests are resolving, e.g., DNS records for the domain are correct and running.
|