I have wrestled for a long while with a problem that has plagued many people. Just witness the number of postings with problems about how to run CRON on this or that web host system. Does the system allow wget or lynx? Does it support running PHP from the cron tab in cpanel? You have to run cron from a browser, need to use 'curl' and what does that mean?

A classic error that is seen in the confirmation email (if cron sends you results via email) is:
Warning: include_once(./includes/bootstrap.inc): failed to open stream: No such file or directory in /home/SiteNameHere/public_html/drupal/cron.php on line 9

So, at least if you are hosted by www.lunarpages.com (LP), here is the definitive answer including how to run cron for multi-site installations. LP does NOT support either wget or lynx and running PHP on the cron command line will not properly invoke the cron.php.

LP supports curl (a/k/a cURL). Some examples of commands that work:
curl --silent --compressed curl http://sub.site.com/cron.php > /dev/null 2>&1 (this will trigger the sub-site silently)
curl --silent --compressed curl http://site.com/cron.php > /dev/null 2>&1 (for a single site installation)

The ' > /dev/null 2>&1' part suppresses sending you an email for each execution.

So, enter cpanel, click on the CRON icon, and using either the simple or the advanced mode, those are the commands that work.
Hope this helps someone.

gil

Comments

Berto’s picture

Thanks Gil!

picturebook’s picture

/usr/bin/curl --silent --compressed examplesite.com/cron.php

aangel’s picture

This worked for me (moodle is in /learn):
curl --silent --compressed curl http://www.postpeakliving.com/learn/admin/cron.php?password=
> /dev/null 2>&1

henns20’s picture

modified my cron tab to-

curl --silent --compressed curl http://site.com/cron.php

I wanted to receive emails at first to verify cron was working and see what the message would be.

(Other way to see if cron is working is to go to Reports->Status report and look at cron maitenance tasks "Last run ...")

Issue:
I am not receiving emails.

To be working the way is suggested i should not receive emails when I use the following.

The ' > /dev/null 2>&1' part suppresses sending you an email for each execution.

If anybody stumbles on this and has the answer before I do and can post i would appreciate it.

still testing...

henns20

henns20’s picture

my cron is working- but still not reecioving emails - thanks for the fix

airforce1’s picture

Hi,

A newbie for linux. So, I would like to know which format is correct below:
curl http://www.******.com/includes/****_curled.php
or
curl home/username/public_html/includes/****_curled.php

Thanks,
David

bwolmarans’s picture

This is required