Running Drupal 6 cron from shell won't work

102 views Asked by At

I want to run cron from the shell directly by calling cron.php or some version of it to avoid executing PHP from apache and use less system resources that way. I've found some instructions here:

http://www.zimplicit.se/en/knowledge/how-run-cron-drupal-6-shell-script-correct-paths

But when I do what's suggested there and I call cron.php clone script (that "fullpathcron.php" script) it just exists and cron is not executed. You can (probably see me question bellow the article).

Any idea why or what's a proper way to run Drupal 6 cron task from shell?

Even more...will I get some noticeable benefits from that?

1

There are 1 answers

0
MilanG On BEST ANSWER

Solved.

Instead of setting $_SERVER variables as described in that example I used part from /scripts/drupal.sh

$_SERVER['HTTP_HOST']       = 'default';
$_SERVER['PHP_SELF']        = '/index.php';
$_SERVER['REMOTE_ADDR']     = '127.0.0.1';
$_SERVER['SERVER_SOFTWARE'] = 'PHP CLI';
$_SERVER['REQUEST_METHOD']  = 'GET';
$_SERVER['QUERY_STRING']    = '';
$_SERVER['PHP_SELF']        = $_SERVER['REQUEST_URI'] = '/';

and it works now.