InMotion Hosting Support Center

Click here to watch a video tutorial


You can use cPanel's Cron Job feature to run Unix commands and/or automate the execution of your PHP, Perl, or Python Scripts. To create a Cron Job, you would first log in to your cPanel under "Cron Jobs" then select either "Standard" or "Advanced." You can also specify an email address that the Cron daemon will send the job's results to.

Set up the Crontab

You can do this easily in Standard Mode, but if you are using advanced you'll need to pay attention to time fields:

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

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

41 04 * * 1 /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 * * 1 = every 41 minutes of every 4th hour of ever 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.

Continued Education in Course cPanel
You are viewing Section 7: 301: How to run a cron job
Section 6: How to find which users are attached to databases
n/a Points
2014-04-16 10:11 pm

how to write this command in curl i try to work out but keep getting error


/usr/bin/wget -O - -q -t 1

11,186 Points
2014-04-17 8:24 am
It looks like you're simply trying to reach a page using wget. To do so using cURL, run something like this:

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

n/a Points
2014-04-17 9:51 am

thank you i will try



n/a Points
2014-04-17 10:40 am

when i  add this command im getting lots email


Cron <fusion37@biz150> /usr/bin/curl --user-agent cPanel-Cron

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current                                  Dload  Upload   Total   Spent    Left  Speed   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0



how to stop please



27,085 Points
2014-04-17 12:25 pm
Hello Umar,

I reviewed your account and it's showing that you spoke with live support a short while regarding this issue. When I reviewed your cron jobs, you do have it running 3 different times, so based on whatever you have running in cron.php, it may return a lot of email. It appears to be a third party application that you're using in the cron job, so you may need to confer with their support or documentation in order to configure it differently if you're getting an excessive amount of email.

If you still require further assistance, please provide us more information on the issue and we would be happy to review it to see if we could be of any help.

Arnel C.
n/a Points
2014-04-18 7:44 am

i have contact to my coder they reply this



  just ask your hosting for antiviral command "/usr/bin/wget -O - -q -t 1 " can work with there hosting server .



11,186 Points
2014-04-18 7:49 am
cURL can accomplish the same tasks as wget is able to so I am unsure as to why they are they insist on using that solution. If you are on a VPS or dedicated server, you may use wget, but if you are on shared hosting (Launch, Power, Pro), you wget is not an available option. On shared hosting, however, cURL may be used instead.
n/a Points
2014-04-18 8:02 am

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


i have this commad work fine only problem yestrday one or support member stop email but now im getting again


i want to make cron job run quite no emails


11,186 Points
2014-04-18 8:43 am
To do so, set the command to:

/usr/bin/curl --user-agent cPanel-Cron > /dev/null 2>&1

n/a Points
2014-04-18 9:35 am

Great that works spot on no more emails



thank you

n/a Points
2014-06-15 2:31 pm

Hi mate, need some help, how do I write thiswget --quiet --output-document - | egrep -o "[^<]+" | wget -q --delete-after -i -I have a website that is taking a lot of time to load, somebody suggested this solution.

11,186 Points
2014-06-16 9:32 am
Could you clarify what exactly you are trying to accomplish with this?
n/a Points
2014-06-16 9:50 am

The website is actually developed in drupal and it takes a lot of time to load, at least 10-15 seconds just to show the title and rest of the website is visible in around 30-40 seconds.Someone on drupal support had written that this command above helped him to and his website now loads within seconds. I have no idea what this command will do. I thought maybe you can help that's why I had mentioned my problem as well. 

11,186 Points
2014-06-16 10:15 am
The command you provided simply grabs your existing sitemap and places it into a file. Either the complete information is not here, or someone may be misleading you. To optimize your site, you will want to slim down any code that you have written, and enable things like browser caching to increase performance.
n/a Points
2014-06-30 3:20 pm

Hi. Can you assist me? I have been trying for days to setup a cron job with no success. I want to fetch this URL:

I am using cron job manager (Linux).

Thanks very much

9,968 Points
2014-06-30 4:08 pm
Hello Lascelles,

If you need to pass URL variables through a cron job, I'd recommend using curl and just put your URL inside of single quotes like this:

curl ''

If you are still having any issues, please let us know how the cron job request looks in your website's access logs when run.

- Jacob
n/a Points
2014-07-01 3:06 pm

Hello Jacob. Thank you for replying to my question. I have setup tests using both curl and wget.

In my email, for curl, I received : % Total % Received % Xferd Average Speed Time Time Time Current

Along with what looks like the entire page html source code.

The most recent access file, dated June 30, basically contains a repetition of the following, plus other miscellaneous info

[30/Jun/2014:00:00:24 -0700] "GET

I am not sure where to go from here.

9,968 Points
2014-07-01 3:59 pm
Hello Lascelles,

Both curl and wget request pages just like a web-browser would, so you will see the status of the page being fetched, and get the resulting HTML back. If you're doing it from a cron job it will be sent to you in an email by default as well.

If you'd like to not see the output from either, simply suppress the output from either with:

curl --silent

wget --quiet

Then also turn off email notifications in your cron job by running it like this:

curl --silent >/dev/null 2>&1

Please let us know if you had any other questions at all.

- Jacob
n/a Points
2014-07-01 5:30 pm

Hello Jacob. Thanks again.

I see some of what I posted has been filtered, so you did not see all the info I entered here.

Even though the cron test(s) appear to show progress, I still have one or two questions:

Firstly, the purpose of this cron is to enable visitors of my real estate website to: log in; save searches for listings not found; receive email notifications as soon as a listing matching their saved criteria is found.

Now, I have logged in as a visitor and saved specific search requirements and then logged out. Then I logged in as Administrator and added a listing matching these requirements, but I have only received cron daemon in my admin email, as I have reported to you, but absolutely no notification in my visitor email.

9,968 Points
2014-07-01 6:00 pm
Hello Lascelles, no problem at all, glad to help.

I did see all of the info you had posted but did strip out the majority of it, since it was just showing the normal output for what curl or wget outputs, and because it contained your domain information.

The cron job you've setup isn't actually going to do anything on its own. It's up to the specific script and URL you're requesting to actually do any work on your site. The cron job is just a way of automating that task by sending a request to the URL at a time interval.

So if there is a particular URL that you go to that sends out the emails to your visitors, that's the URL you'd want to set your cron job to go to in order to automate that task.

So basically, I'd test first to make sure you can do what you need to in a web-browser, also making sure that you aren't logged in as the admin or anything. Then if you're hitting a particular URL to start sending out the notification emails and it works from your web browser (again not logged in as the admin) then you could use that URL in your cron job to do that task on a set schedule.

If you have to login as the admin in order to complete the task, then that's a whole different story because then you'd have to pass along your admin credentials in the curl or wget request so that it handles it the same way. For instance when I try the full URL that you had shown in your access-logs in my web-browser I get Invalid Token. So not sure if it requires you to be logged in.

It looks like you're probably running a Joomla site and the com_iproperty component is responsible for handling your email notifications. You might need to consult the documentation of this component to see what it recommends for setting up cron jobs specific to it.

- Jacob
n/a Points
2014-07-02 6:12 pm

Thanks again Jacob.

Yes I have a Joomla/com_ip site. The cronscripts appear to be setup correctly but I'm not getting the desired results from the fetched URL, so I am currently in touch with the relevant developers. I will post here again as soon as I have some developments.

9,968 Points
2014-07-02 6:15 pm
Hello Lascelles,

No problem at all, glad to help. Hopefully they'll have an answer for you, please check back and let us know what you find out. If they need any info from us at all just let us know!

- Jacob
n/a Points
2014-07-06 9:18 am

Hi Jacob,

I've followed your advice and I get this error:

/usr/local/cpanel/bin/jailshell: /usr/bin/wget: Permission denied

The command I'm using is:

wget --silent ''

When I run this job directly from my browser it works, but when I run it from cron tab I get the above error.

Can you advice what I'm doing wrong?



9,968 Points
2014-07-06 4:24 pm
Hello Birgir,

If you are getting the /usr/bin/wget: Permission denied error, you'll want to use curl instead as wget has been disabled for users on your website.

Please let us know if you're still having any issues.

- Jacob
n/a Points
2014-07-07 1:54 pm

Hello Jacob,

I changed it to curl but now I get this error:

Error 406 - Not Acceptable

An error has occurred. Generally a 406 error is caused because a request has been blocked by Mod Security. If you believe that your request has been blocked by mistake please contact the web site owner.

Any idea?



27,085 Points
2014-07-07 3:29 pm
Hello Birgir,

Sorry for the continuing problem. It appears that you're not including the user agent in your statement. Also, if you read Jacob's comments on this issue, he indicates that user credentials need to be included. This is why you are running into the mod_security issue. I hope this helps to provide some answers. Check out this article on using CURL if you require more details.

Kindest regards,
Arnel C.
n/a Points
2014-08-06 3:48 pm

I tried:

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

 /usr/bin/curl --user-agent local

these two didn't work. any idea?

19,030 Points
2014-08-06 4:42 pm
Hello Young,

Thank you for your question. I confirmed your cron jobs ran successfully in the server logs.

For example, your curl cron is running, but nothing happens because it's just displaying the page after.

If you have any further questions, feel free to post them below.
Thank you,

n/a Points
2014-08-06 5:57 pm

Thank you for your quick response John!

Now, I know my curl command through cron job is working, but my system doesn't recognize the amazon batch report if the command is ran through cron job. 

But I checked my system reported two cron jobs that ran by you, but it doesn't recognize cron jobs set by me. How did you run those cron jobs? What would be the difference that your test run is recognized, but mine doesn't?

30,216 Points
2014-08-06 6:56 pm
Hello Young,

John-Paul did not run a separate test but confirmed that your cronjobs did indeed run on the server.

Kindest Regards,
Scott M
n/a Points
2014-08-23 2:50 am
i think i was alright
n/a Points
2014-11-13 2:20 pm


I've set up a crontab that runs a php script. It launches ok but quits unexpectedly after about 5 minutes of execution. The command is php -q /home/user/batch/script.php

Do you know what could be wrong? The script runs ok if i launch it from ssh, but not using your crontab feature..

19,030 Points
2014-11-13 2:51 pm
Hello Lauren,

Thank you for your question. I would first check for any PHP errors being generated. If you are hosted with us, you can view PHP errors in cPanel.

We are happy to help further, but would have to see the nature/code of the script to troubleshoot further.

Thank you,
n/a Points
2014-11-13 3:45 pm

Hi John-Paul and thanks for your support. Yes, I'm hosted by you guys. I checked for error_log files in the directory where the batch is triggered (or anywhere else for that matter) without success. Like I said, the script has been tested extensively using ssh to log remotely to the server hosting my files, but won't sustain more than 5 minutes of execution using crontab. the script is named grabphrasesbatch.php and located in /home/compag6/batch/

It is quering 3 restful apis and consuming some network resources. It also updates database tables created on the fly, and starts by loading a big list in memory. But the cron is emailing me when the job exits, again with no errors in the traces of the email.

If you need further input, or need anything else to assist


19,030 Points
2014-11-13 5:54 pm
Hello laurent,

Thank you for your question. 5 minutes is a really long time for a PHP file to run, and it may be reaching a limitation for a Shared Hosting environment.

It may may be easier to submit a ticket to review your account at the time the cron jobs are running.

This also allows them to provide account specific information in a secure and private setting.

Thank you,
n/a Points
2014-11-14 3:32 am

yeah, i suspect something like this.

Ok, thanks again for your support

n/a Points
2015-05-23 1:17 pm

I'm confused, I'm afraid... So... shared server..

I see how a curl cron job can be constructed, however in the article...

It says to make the cron job like this...

cd /home/userna5/public_html; php -q wp-cron.phpI'm asking because I've been using the above and it's been fine but it's now causing a problem with the new version of the Wordfence plugin.In the Wordfence plugin support, they are recommending using a wget... but that's not available on inMotion shared hosting and you say to use curl.Can you unconfuse me and definitively say what I should use as a cron statement if I want to disable the wp-cron and instead run the cron from my cPanel?Thanks! 
5,833 Points
2015-05-27 12:13 am
Hello Ken,

You can use curl by following the guide in the following article.

Best Regards,
TJ Edens
n/a Points
2015-05-27 11:45 am

Hi TJ,

Thank you for the link about making a cron job. I have seen that article... In fact it's the same article that this thread is in!

My question is that this article says to use...

/usr/bin/curl --user-agent cPanel-Cron (for WordPress I assume it should be wp-cron.php)and the "Disable wp-cron in WordPress" article says to /home/userna5/public_html; php -q wp-cron.phpWhich is preferred? In what ways are they different? Obviously one is a curl... what's the other?Seeing two different ways of "properly" doing a cron job is confusing. I'd appreciate a detailed response please.
27,085 Points
2015-05-29 10:32 am
Hello Ken,

Sorry for the problems with writing a cron job with CURL. Mainly, this option is provided for advanced user - and little to no documentation. We unfortunately can't provide to much information on it, as it should be typically setup by a programmer with knowledge. Additionally, this delves into the realm of providing code, which is normally not something within our scope of our support. However, you might want to check out these two posts as they may provide the information that you seek:

Creating a Cron Job
Examples of CURL

I hope this helps to answer your question, please let us know if you require any further assistance.

Arnel C.
n/a Points
2015-09-07 2:02 am

How does the cron.php file trigger the sitemap.xml regenration automatically? And how does it trigger the regenration of  the googleproducts.xml file?  Are there specific command lines necessary within the cron.php file that address these in order to trigger the function?

19,030 Points
2015-09-08 5:53 pm
Hello Oscar,

Thankyou for contacting us. The above guide explains how to schedule and setup a cron. It will then trigger the script at the intervals you specify.

You will have to code the script to function as needed.

Thank you,

Post a Comment

Email Address:
Phone Number:

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

42 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!