cron

As discussed in previous blog post, drush cron can be run from crontab too. While seeming pretty straightforward, trying it out caused some troubles.

The thing you would do to make drush run from crontab is:

$ crontab -e
* * * * * drush -r /path/to/drupal

Also tried to give full path to drush install

$ crontab -e

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 http://yoursite/cron.php

By big imports I mean creating millions of nodes and indexing them fo apache solr search. We needed to import 1 million records from file and we needed to create 3 nodes for each record, one in each of our 3 languages. So this gave us the task of creating scripts for creating, updating and deleting 3 millions nodes.

In the command line type

crontab -e

Press your insert key.
Insert a line, run every five minutes for example (more on syntax http://unixhelp.ed.ac.uk/CGI/man-cgi?crontab+5)
5 * * * * /usr/bin/lynx -source http://yoursite.com/cron.php

And now exit: press escape and type ":exit"
By exiting you are saving and you wont be prompted.

Syndicate content