How to configure cron jobs in Cpanel for my Drupal site
newbie8 - September 16, 2006 - 07:55
Hello again.
My site has rss news feeds that do not "update" automatically. I learned that the cron jobs need to be configured for it to automatically update.
I installed Drupal using cpanel/fantastico. I have seen a cron jobs area at cpanel and there is a blank slot to enter something to run.
What should I enter in that cpanel/cron jobs blank area?
Please note that I am a newbie and would not understand Drupal or php linggo.
I have researched on the topic but none of the answers seems to fit with the cpanel cron jobs topic.
Thank you.

Does HOWTO: Install Drupal
Does HOWTO: Install Drupal using cPanel subheading Cron tasks contain the relevant information?
--
The Manual | Troubleshooting FAQ | Tips for posting | How to report a security issue.
Thank you for your prompt
Thank you for your prompt reply.
Based on the topic/link you suggested, it still does not answer it clearly for a newbie like me.
I am currently inside the cron jobs area inside cpanel and there is a space which says "command to run" and below that are some parameters relating to "time" and below that are buttons: "save crontab" and "reset changes".
What should I input inside the "command to run" area?
Is it ...www.example.com/cron.php ?
The instructions provided are not clear for newbies.
Thanks again.
Here you go
wget -O /dev/null http://www.yoursitename.com/cron.php 2>/dev/nullFrom the page
From the page:
To run cron.php every day set the Minute and Hour fields to
0and the rest of the fields to*. The command to run is:GET http://www.example.com/cron.php > /dev/null(note, the only cpanel server I had access to required GET)
--
The Manual | Troubleshooting FAQ | Tips for posting | How to report a security issue.
Thank you both for your
Thank you both for your inputs. I have noticed that there are slight differences with both commands. Will they have the same results?
This is something to add to the "manual" if it works. Will try it out and will let you guys know if it works.
How can I tell if it will work?
It works! I checked the
It works! I checked the aggregator area and it shows that the news feeds have been refreshed. Thank you once again for the help and support in this wonderful community.
Thanks also
I too spent quite a bit of time on this issue.
For two years I have had to suffer the indignancies of CPanel's ridiculous docs.
It wouldn't be so bad if they at least made it possible to submit corrections to their documents. I'd do it for free, if they wouldn't make it so full of rings to jump through just to log in.
Again, thanks to all of you who helped!!!
URL to your cron.php inside
URL to your cron.php inside your drupal installation
http://domain.com/cron.php
http://domain.com/mydrupal/cron.php
*Download and use poormanscron.module
Oops it is not working. I am
Oops it is not working.
I am receiving many emails with this "/bin/sh: /usr/bin/GET: Permission denied" regarding the cron jobs. I thought it was working but it only got "refreshed" when I typed www.example.com/cron.php
Thanks!
I have your answer...
my fellow newbian..... (LoL)
You are in luck! I was in your shoe before and nobody seemed to understand what it means when you have no idea what these codes mean.
1) While in the "Cron Jobs" section, select either Standard or Advance
2) The minutes, hours, month, etc. should be the easy part
3) Now here's what you need to input in the command line...
cd 'type in your site path here' ; php -q 'cron.php' > /dev/null 2>&1
mine is rather lengthy, but you should get the gist of it....
cd '/.../.../.../.../rcForum/' ; php -q 'cron.php' > /dev/null 2>&1
I hope that helps you.
Diva Webmistress
http://ranchcardoso.biz/rcForum
http://bodyinparadise.com/bpForum
Thanks for the input Diva
Thanks for the input Diva Webmistress. How will I know if it is working already?
Be sure to set the cron job
Be sure to set the cron job to check for feeds every 5 minutes, then go to your log files and it should give you something like this...
cron 09/18/2006 - 10:00 Cron run completed Anonymous Visitor details
As soon as you know it's working, be sure to change your cron job to check for feeds every hour or more.
I hope it worked for you.
Diva Webmistress
http://ranchcardoso.biz/rcForum
Hi again. It does not seem
Hi again.
It does not seem to work since I am now getting these emails instead from the cron daemon "/bin/sh: line 0: cd: http://example.com: No such file or directory" .
I apologize that this is getting to be an old topic but I can't seem to make it work. Is it the host?
Thank you again.
Are you typing in...
Are you typing in "http://www.example.com" as your site path?
Your site path should be your actual website name or the root directory path from your hosting company. It's where all of your files are contained within their server.
What is your website and forum site name?
Diva Webmistress
http://ranchcardoso.biz/rcForum
http://bodyinparadise.com/bpForum
Poormanscron.module then,
Poormanscron.module then, its easy to install, no messy table, just upload it to your `modules' folder
Then admin/settings/poormanscron - set it time interval you wish
Hi. My website is
Hi.
My website is www.thewatchworks.org hosted by hostgator and I installed drupal using cpanel's fantastico. It is the latest version of Drupal.
As you may see, I have some rss feeds there which I want to automate.
Thank you.
It seems to me that you are really a Newbie
What MuslimGuy means is :
1. Download poormanscron from http://drupal.org/project/poormanscron to your desktop
2. Upload the file (the gzipped file) to drupalfolder/modules using the CPanel File Explorer
(In your CPanel find file explorer, navigate to the modules folder and then click "browse" to upload the file
when the file is in the folder click on its name and on the right side should give you an option to "extract contents" this will "unzip" the file inside the modules folder)
3. Go to your drupal admin/settings/poormanscron and configure it
--
Chios Greece sightseeings
That was the best solution
That was the best solution to the problem! It was that simple...LOL! Only a module was needed.
Cheers and thank you to all that helped-out!
Thank you kingeo for the
Thank you kingeo for the URL
I havent been able to memorize Drupal URLS / links to modules
Just to add...
I think Poormanscron is a bit greedy on server resources and probably not the best idea if you run it often. The Sanitycheck module doesn't like it, anyhow.
I'm on Clook (great ISP:-) and their CPanel crontab doesn't allow WGET or GET for security reasons, but this appears to work:-
/usr/bin/php -q /home/myusername/public_html/cron.php(adjust '/home/mydomain/public_html/' to suit your hosting co's server path)
However, crontab emails me each time cron.php has run and every mail contains a ton of this sort of stuff
<br /><b>Warning</b>: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cookie - headers already sent in <b>/home/username/public_html/includes/session.inc</b> on line <b>10</b><br />
<br />
<b>Warning</b>: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at /home/username/public_html/includes/session.inc:10) in <b>/home/username/public_html/includes/session.inc</b> on line <b>10</b><br />
<br />
<b>Warning</b>: opendir(misc/fscache/4A) ...etc...
(NB I've edited my actual 'username' out of the above)
This looks like some sort of cookies issue, through running cron.php outside a browser session (?) It doesn't seem to stop it working; Drupal Watchdog logs 'cron run completed'. Once I was sure it was working I appended '> /dev/null ' to the crontab command-tail and it is now working silently, no more emails nor log entries.
Regards
Tony Sleep http://tonysleep.co.uk
Cron cPanel and multi sub sites.
I am restricted to this method in cPanel:
/usr/bin/php -q /home/myusername/public_html/cron.phpThis only runs cron for the main site. How do I run it for a sub domain site?
--
Mr Chatter
I have subdomain sites
I have subdomain sites and the method works fine in them. Assuming your subdomain is under, let's say
/home/myusername/public_html/domain1then your cpanel entry would look like:/usr/bin/php -q /home/myusername/public_html/domain1/cron.phpanother cronjob would be set for:
/usr/bin/php -q /home/myusername/public_html/domain2/cron.phpand so on. One cron job per subdomain.
My case - shared host
This method
/usr/bin/php -q /home/cpanel_user_name/public_html/cron.php
works fine with me. If you want to be informed via email, then do not use -q
If your site is: www.domain.com/drupal, then
/usr/bin/php -q /home/cpanel_user_name/public_html/drupal/cron.php
This one is also ok:
cd /home/cpanel_user_name/public_html/drupal/ ; php cron.php
The method
GET http://domain.com/cron.php > /dev/null
works with my Ubuntu localhost, but does not work for Cpanel.
My cpanel version is 1.0.
How does this work when all
How does this work when all the sub-domains share the same code base and use /sites/domain to differentiate them? How do you call cron for each site separately?
try this:
try this for subdomain.domain.com:
/usr/bin/php -q /home/cpanel_user_name/public_html/subdomain/cron.php
You need to tell your cron.php located (drupal installed).
That isn't going to work. I
That isn't going to work. I have 4 Drupal sites all using a common Drupal install in the public_html directory. The sites are called through /sites/site1 /sites/site2 etc. All four sites use separate database tables but share the exact same cron.php file:
/home/cpanel_user_name/public_html/cron.php
It makes it a no-brainer for updating Drupal code but it's impossible to run cron for the add-on sites. How do you call cron for a specific site using /usr/bin/php (and GET / WGET don't work)?
Possible to get cron jobs to work with multi-site setups?
Is the above correct - that it is not possible to get cron to work in multi-site setup?
If so, is it possible to get around this with some programming of the script?
Do we need a combination of a modified script and a special drupal module that goes with it?
I would like to get automated cron to work on multi-site setups where most or all the sites require login to access the data.
more poormans cron
hi ... this was helpful to me, however, after following the instructions and installing the module, when i went to configure it it said:
warning: Missing argument 2 for drupal_get_form()
um, so where do i go from here ???
please and thanks :)
Your best bet is usually the issue queue of the specific module
So in this case visit
http://drupal.org/project/poormanscron
development > all pending issues
if you don't find anything
fill out a new a bug report or support request for pathauto 5.x
so people involved in the project can either fix the bug or
help you with your problem
GiorgosK
------
Good read for newbies > http://drupal.org/node/120612
Lots of Discussion and help is going on in http://groups.drupal.org/ too, join in
Worked like a charm
Thanks, worked like a charm.
To test if it is actually firing you can remove the last section - > /dev/null 2>&1 and make sure you have a good email address in your crontab section of your cpanel. Once you're happy, add in the > /dev/null 2>&1 section or just try to remove your email address - or do both.
Another way is to go into your 5.x install of drupal and look in admin -> logs -> status and see when cron last ran -- see if it updated.
First of all you have to set
First of all you have to set permission for your file to be able to execute it... then you need only this line: php -q /home/username/publi_html/file.php where username is your main user for cpanel. -q for quite mode to not return status.
Hint in cPanel
Just noticed that if hit Advanced User option in my cPanel - even tho not planning to do advanced stuff, I find:
Hint: to run PHP files, enter the command as follows (modify to fit your needs):
GET http://yourdomain.com/path_to_file/file.php > /dev/null
- didn't get such a hint with Standard skills option (err, no cron skills at all in my case, but no option for that).
- maybe handy if cron commands can differ somewhat between versions of cPanel - or (maybe happens more) between hosts, as way of checking command to use.
CheungChauHK 長洲HK - South China Sea island in Hong Kong.
Finally got CRON to run under Cpanel - But...
This is the email I get..
Warning: main(./includes/bootstrap.inc): failed to open stream: No such file or directory in /home/user_name/public_html/cron.php on line 9
Warning: main(): Failed opening './includes/bootstrap.inc' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/user_name/public_html/cron.php on line 9
Fatal error: Call to undefined function: drupal_bootstrap() in /home/user_name/public_html/cron.php on line 10
I have obviously changed my username, but any ideas??
==================================
EDIT >>> I now have it working correctly with
cd /home/user_name/public_html/ ; php cron.phpWorks fine but took some poking and hoping until it did
Sweet!
Thanks thoughtvoid!!! The following command in cpanel 10.9.0-RELEASE in Cron Jobs under Advanced Tools worked for me too:
cd /home/user_name/public_html/ ; php cron.php
Where I changed user_name to my site's username (username used in ftp). I checked the Administrator>Logs in Drupal 5.1 and noticed the following:
cron 04/18/2007 - 21:26 Cron run completedAwesome!! Now I just need to change the time to run each hour instead of 5 minutes that I chose!
The only one that worked for me
Hi folks - I run my site as an add-on domain in CPanel. I tried everything above, and the last one is the only one that worked for me:
cd /home/user_name/public_html/ ; php cron.php
Thanks a bunch!
Yes, This one works for me
Yes, This one works for me also. Others suddenly do not work (it worked before).
cd /home/cpanel_user_name/public_html/drupal/ ; php cron.php
mysqli
I tried the above cron line, and it almost(?) works. I'm using Drupal 6 Beta 3, which may throw things off. Anyway I get the following error message in my email:
"We were unable to use the MySQLi database because the MySQLi extension for PHP is not installed. Check your PHP.ini to see how you can enable it."
I'm hosted at hostgator, and I'm not sure if I need to enable something on their end, or on the Drupal side of things.
Below are the steps to run
Below are the steps to run Drupal 53's cron.php in my cpanel
1. click on cron jobs
2. click on standard
3. set email to your dedicated email in case anything goes wrong
4. set command as "php /home/user/public_html/Drupal53/cron.php" (without double quote)
5. set the rest as Every Minute, Every Hour, Every Day, Every Month, Every Week Day
Notes :
1. user in step 4 must be your user name in your hosting package
2. Drupal53 in step 4 may not be a must but I do that because I put all Drupal files in a folder instead of my www site.
Happy Cron ^_^
Webserver
This is wrong; cron.php needs to be accessed via the webserver. Do
GET http://www.example.com/cron.php > /dev/nullorwget -O /dev/null http://www.yoursitename.com/cron.php 2>/dev/nullmentioned earlier in the thread not work for you?In desperation, one can also setup a cronjob on another system (such as http://www.webcron.org/).
--
The Manual | Troubleshooting FAQ | Tips for posting | How to report a security issue.
Dear Heine, Have you
Dear Heine,
Have you try on it? It works and I get Cron Status restart counting in the log's status session.
Thanks for replying.
Seems like we are rehashing
Seems like we are rehashing things a bit here, but I think the problem with GET, is that most servers don't allow it.
I know when I try it, I receive the following error:
/bin/sh: /usr/bin/GET: Permission denied
For me: cd /home/ardarvin/public_html/site2/ ; php cron.php
is the closest I've come to getting cron to run, as I at least get a drupal error response...the mySQLi error. Anyone know how to overcome this one? Again, I'm using Drupal 6, Beta 3.
cron job
"cd /home/cpanel_username/public_html/ ; php cron.php" !
Of course you have to replace cpanel_username by your cpanel user name.
We probably should take all these FAQ's and write a "how to" book for Drupal
Thank you! all
Cron Permission denied
I have Drupal 6.2 running and followed the instructions per David Mercer's Drupal 6 book which says to open the cpanel and insert:
/usr/bin/lynx -source http://www.mysite.org/cron.php
and asked email be sent to me per cron job.
I too received: /bin/sh: /usr/bin/lynx: Permission denied
There are several variants posted here and I was wondering if someone could point out which one I should use?
Got it working
I believe I tried every answer here but the only one that worked is:
cd /home/cpanel_user_name/public_html/ ; php cron.php
Thanks all
Hopefully I haven't open some huge security hole!
Using CURL for cron
I have found you can also use CURL to call the URL for cron.php
This means you can set up a separate cron job for each multisite domain/subdomain
e.g. */5 * * * * /usr/bin/curl -s http://subdomain.example.com/cron.phpTry it first without the -s switch (silent) to see that it is working or with a -v switch for verbose output.
Noel
subcrip
subcrip