Saturday, May 7, 2011

Running cron jobs for Drupal on a shared host.

Ok, this isn't normally the hardest thing in the world to set up, but as I didn't have shell access I didn't get around to doing this (and ran the cron jobs manually).
In fact, setting up automatic cron jobs via Cpanel is quite easy (and you can read more about this - here
On Cpanel, in the "Advanced Section" you can click on cronjobs. There are fields you can enter to determine how often the cron job is run. For example, if you enter 15 in the Minute box, the job can be run at 15 minutes past the hour. The top box allows common settings eg once a week, or once a hour, so you don't need to enter criteria directly into every box. The most important task though is to enter your command line correctly. If you have lynx enabled on your Linux server, you may wish to use that, but the wget command is probably more common on nix boxes. So for my job at www.mygreatsite.com I put in the following command:
wget -O - -q -t 1 http://www.mygreatsite.com/cron.php


The -t 1 switch merely states try again once upon failure.
Anyway after pressing the "Add Cron job" button, that's all that needs to be done. The crontab program will perform your regular updates from now until the program is modified, or the server blows up!
If only other IT tasks were so easy to set up and then leave alone.

No comments:

Post a Comment