Setting up the Drupal cron Job under SuSE 10 / Plesk 8

Blog Topics:

Drupal requires http://example.com/cron.php being called regularly. You can set this up in Plesk within each site. Plesk will create a corresponding entry in /var/spool/cron/tabs/site_user. The downside of this is that each cron run will produce an entry in the /var/log/messages system log. If you have a couple of sites and each one runs the cron job every hour, then you'll easily end up with hundreds of useless system log entries every day!

You can avoid generating a system log entry by inserting a dash in front of the cron entry, but this only works for cron entries that belong to root. So, going from here

10 * * * *  site_user  wget -O - -q http://example.com/cron.php

to

-10 * * * *  site_user  wget -O - -q http://example.com/cron.php

will not work, but will actually disable the cron job.

The solution is to remove the cron job in Plesk and to create a /etc/cron.d/example.com file as follows:

-10 * * * *  root  wget -O - -q http://example.com/cron.php

It's probably a good idea to create a separate file for each site, to keep things straight, and this will do exactly what we want.