Tuesday, March 06, 2018

Running Cron in Drupal 7

I'm having big snags running the Cron task in Drupal 7 via my main host.

Rather than trying to call Cron with wget or lynx (which has resulted in many failures), I found a simple structure is to call cron via Drush, for example:

drush --root=/home/cognimatic/public_html --quiet cron

Either use your cPanel interface to edit Cron tasks or follow the guide at https://www.drupal.org/docs/7/setting-up-cron-for-drupal/configuring-cron-jobs-using-the-cron-command to edit your Crontab. Just make sure Drush can be called from anywhere within your server file structure and you define the root directory (the one that will have index.php and robots.txt etc in it) for your Drupal site.

Just remember you need to have Drush running on your hosting server to use this approach - see https://www.drupal.org/node/2366283 or a previous post on this blog to help you.

Nothing's easy. If it was, everyone would do it.


BT