2

I have created a test instance of CiviCRM that uses Drupal 7 as the CMS. It's running inside a Ubuntu Desktop virtual machine that has a LAMP stack installed on it (Apache2, php7.2 and mySQL).

I am very new to Linux and would like to set up a cron job to run CiviCRM's scheduled tasks. I have looked at https://docs.civicrm.org/sysadmin/en/latest/setup/jobs/, but I confess that I find it confusing. I haven't set up any cron jobs for Drupal, either. Can anyone help me, please?

Many thanks in advance,

Daniel

2

Welcome to SE! Setting up cron can be confusing since there are many variations and it touches several aspects: OS users & permissions, CMS users & permissions, other tools, cron - and the details depend on your hosting environment.

I've just re-read the page you linked to. It has the information you need, but it also has other options that you don't need, so work through that step by step. (I've also submitted a few clarifications.)

So, following the 'Preparing' section and assuming a typical Ubuntu installation:

  1. Choose a command: I prefer the cv method
  2. OS User: Ubuntu typically uses 'www-data' to run Apache. (Adjust below if different.)
  3. CMS User: Create a Drupal user (eg 'cronuser') with the listed permissions

If you don't have cv installed already, go ahead and install it.

Check that you can run the command manually:

$ sudo -u www-data cv api job.execute --user=cronuser --cwd=/var/www/html

(If your installation is not under /var/www/html adjust accordingly)

Then add it to the crontab for www-data:

$ sudo crontab -e -u www-data

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.