How to run drupal cron from cli
Running cron from cli in drupal will result in.
PHP Warning: include_once(): Failed opening './includes/bootstrap.inc'
Running cron from cli is useful when your behind external authentication and crontab is not available over http. Because normaly you would put something like:
0 * * * * wget --spider <a href="http://yoursite/cron.php
So here is what you should put in the crontab when you want it to call from cli. (Edit using "crontab -e" as command)
* * * * * php /home/ddcooman/workspace/extranet-client/src/drupal/cron.php
As said this gives the error. So here is the solution:
Create a new cron file "cronlocal.php" containing:
// $Id: cronlocal.php Exp $
* Handles incoming requests to fire off regularly-scheduled tasks (cron jobs).
The chdir will change the directory and bootstrap drupal. After drupal is bootstrapped the drupal cron is executed.
Tip: You can also use this trick to bootstrap drupal for running import scripts. The whole drupal api is available when drupal is bootstrapped.