Search form

Set up CiviCRM cron for a Drupal site on cPanel

This lesson looks at how to set up cron for CiviCRM (on Drupal) in a cPanel environment.

Setting up a generic CiviCRM cron task in CPanel

Here’s a quick guide on how to set up a CiviCRM job that will check and run all active scheduled jobs in your CiviCRM site, according to the schedule defined for each job. I have this working on two separate Drupal/CiviCRM sites with different cPanel hosts. Please leave a comment below if this doesn't work for you, explaining the steps you took and how you got it working (if you did).

In CPanel, create a job to run every 1 minute (or maybe 5 minutes or 15 minutes, depending on how accurate you want the scheduled starting time for CiviMail jobs to be, i.e. if someone schedules a CiviMail campaign for 11:50 and you have a 15 minute cron, it won’t send until 12:00). Here's an example of a CiviCRM cron task that will run every five minutes:

Setting up a CiviCRM cron job on Drupal in cPanel

Here's the full command from the screenshot above:

wget -O - -q -t 1 ''

Let’s break it down:

  • wget is a command to retrieve a URL from a remote server. The parameters are needed to get the cron to run - without the parameters it will fail with no logging visible in cPanel.
  • URL points to the cron.php file within your site.
  • Name = a Drupal user with permission to Access CiviCRM, Access CiviMail, View All Contacts. I've used a user account called CiviCronUser in this example, and added it to a role with just these permissions.
  • Pass = the password for that user
  • Key is the CiviCRM site key from sites/default/civicrm.settings.php (change this path if the site is in a different folder inside sites).

Setting up CiviCRM cron tasks for individual scheduled jobs

Remember too that CiviCRM allows you to control the cron for individual scheduled jobs separately. This command will just process emails:

wget -O - -q -t 1 ''

Each scheduled job has its own machine name which you can obtain by examining the list of scheduled jobs in CiviCRM for the API action:

This example shows the Send Scheduled Mailings task within that list:

The idea here is that you can schedule the cron to run more frequently for some scheduled jobs. In the example above, you'll see the process_mailing job is set to run Always. This means that any time the generic CiviCRM cron job (the first example above) or the specific process_mailing cron job (the second example above) is run, the process_mailing job will be run. So, you could schedule the first, general cron job to run every hour and the process_mailing job to run every 5 minutes.

In this example, remember to make sure that the setting in the scheduled job is at least as frequent as the matching cron schedule. In other words, if you set up a process_mailing cron task to run every minute, but the scheduled job in CiviCRM is set to run every 15 minutes, then this cron job will running more often than it needs to - it will check every minute, but only run the process_mailing task once every 15 minutes.


This lesson demonstrates a working example how to set up CiviCRM cron in Drupal on cPanel. However, it is entirely possible that this scenario won't work for you. If not, you can visit this wiki page from the CiviCRM site for more information and guidance on how to handle different circumstances. If you get stuck, feel free to comment below on your specific scenario, in case we, or one of our readers, are able to help out with a solution.

Our Comment Policy.

We welcome your comments and questions about this lesson. We don't welcome spam. Our readers get a lot of value out of the comments and answers on our lessons and spam hurts that experience. Our spam filter is pretty good at stopping bots from posting spam, and our admins are quick to delete spam that does get through. We know that bots don't read messages like this, but there are people out there who manually post spam. I repeat - we delete all spam, and if we see repeated posts from a given IP address, we'll block the IP address. So don't waste your time, or ours. One other point to note - if you post a link in your comment, it will automatically be deleted.

Add a comment to this lesson

Comments on this lesson


Great Lesson! thank you

Add comment