InMotion Hosting Support Center

Running Cron Jobs:

You can use cPanel's Cron Job feature to run Unix commands and/or automate the execution of your PHP, Perl, or Python Scripts. You can also specify an email address that the Cron daemon will send the job's results to.

How to get to the Cron Job Page in cPanel

Follow these instructions to navigate to the Cron job page in cPanel:

  1. Login to cPanel.
  2. find the advanced section

    Scroll down until you find the Advanced section.

  3. Click on Cron jobs

    Click on Cron jobs. This will bring you to the Cron Jobs page.

Setting up the Email Notification

Your cron job can notify you through email everytime it runs. Simply type in the email address you wish to use in the field labeled Email, then click on the Update Email button. If you don't want the notification, then you would need to redirect the command's outpupt like this:

mycommand >/dev/null 2>&1

The "mycommand" would be replaced by your command.

Set up a New Cron job

Specify when the cron job will run. The order is:

[minute] [hour] [day] [month] [weekday] [command]

41 04 * * * /my/script -v

This will run every morning at 4:41AM. The * is a wild card, meaning "every day/month, etc" For example; 41 04 * * * = every 41 minutes of every 4th hour of every day of every weekday of month. Weekday is every day of the week including the weekends. Many customers have thought that weekdays are only Monday - Friday, instead of interpreting it as Monday - Sunday.

When setting the time, it is also good to set the cron to run at an odd minute, instead of the top (example: 12:00) or bottom (example: 12:30) of the hour. The example above runs at 4:41. The reasoning behind this is that most people set their crons to run at either the top or bottom of the hour. If everyone runs their crons at the same time, this can cause the crons to run slow and even slow the overall server down for regular website traffic. Setting it at an odd time ensures better performance of the script.

Specify the command to run

The command will have two parts:

[program to execute (perl/pyth./php)] [switches] [script]

The program to run will specify the type of script you are running and will either be:

  • php
  • Python

The script will need to be called on its direct path as it is located on our server, so it will be something similar to: /home/userna5/public_html/path/to/script, with "userna5" being your username.

perl/cgi scripts should be in your cgi-bin, with permissions of 755 Please read our article on file permissions for more information.

  • To run a PHP script: php -q /home/usern5/public_html/scripts/testrun.php
  • For Python scripts: python /home/usern5/public_html/path/to/script
  • For Perl/CGI scripts: /home/usern5/public_html/cgi-bin/

Using the User Agent String

The wget command is disabled on all the shared servers for security purposes. Most scripts that are run via wget can be used with the lynx or curl command. The new mod_security rules that were applied with the latest php updates will prevent lynx and curl from working if a user agent is not set. To set the user agent, you can use the following command:

  • curl --user-agent YOUR_STRING (URL)
  • lynx -dump -useragent=YOUR_STRING (URL)

Your full cron job command would end up looking like this:

/usr/bin/curl --user-agent cPanel-Cron

In this case we defined our curl User-Agent to be cPanel-Cron, you can set it to be whatever you'd like, so long as it is defined in your cron command as something.

Cron Job Troubleshooting

If you need further assistance please feel free to ask a question on our support center website about your cron job issues.

Was this article helpful?
Continued Education in Course cPanel
You are viewing Section 16: How to run a Cron Job
Section 15: How to find your Server name in cPanel
Section 17: How to Find Your Shared Server IP Address in cPanel

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Support Center Login

Our Login page has moved, Click the button below to be taken to the login page.

n/a Points
2018-09-05 3:13 pm


Just wanted to thank you for saving my a....s. I looked for a solution for days until I found this! fantastic job!

n/a Points
2018-01-10 6:44 am

I want you to know that you helped me resolve a problem with my cron job on my website,, that I've been working on with one of my developers for months!  Thank you so much for posting this informaiton!

Best Regards,


Post a Comment

Email Address:
Phone Number:

Please note: Your name and comment will be displayed, but we will not show your email address.

4 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!