1. Home
  2. Hosting
  3. cPanel Hosting
  4. How to setup Cronjob in cPanel

How to setup Cronjob in cPanel

Here is a step-by-step on how you can setup a cronjob in cpanel

This article assumes you are already logged into your cPanel account, if you do not already know how, please review How To Change Your Password as it will teach you how to log in from your client area.

  1. Under the Advanced section, click on Cron Jobs
  2. On the next page you will see Add New Cron Job at the bottom portion of the page. On the page it lists some example how you would setup a cronjob.
  3. For this example, we will setup a cronjob that runs every hour. We can select under the Common Settings -> Once Per Hour. Then we scroll down to the bottom in the Command field, we would fill in our path to our script. Since our script is PHP, we would need to use the php binary path as well.

    /opt/cpanel/ea-php71/root/usr/bin/php /home/your_cpanel_username/public_html/my_cron_job.php >/dev/null 2>&1

    In the above example, we called the PHP binary for PHP7.1 (/opt/cpanel/ea-php71/root/usr/bin/php ). If you want to use another php version, simply change the php71 to another number, such as php74 etc..

    then the path to our script is (/home/your_cpanel_username/public_html/my_cron_job.php)

    Lastly, we don’t want to receive any notification on the cronjob status so we add the following into the command (>/dev/null 2>&1)

    Click the Add New Cron Job button at the bottom once you are ready and you are all set!

Not a customer? Did you like this knowledgebase article?
If you did like this knowledgebase article and are not currently a customer but are looking for a trusted offshore host, feel free to browse what we have to offer over at OrangeWebsite. We have products that fit everyone from individuals to small, medium, and big-sized businesses. We just might be what you are looking for.

Updated on July 29, 2024
Was this article helpful?

Related Articles