0

I'm running CiviCRM 5.32.0 on WordPress 5.6 hosted by Hostinger.

1st step I test cv.phar = php /xzy/wp-content/plugins/civicrm/civicrm/bin/cv.phar api Job.process_mailing --user=abcd --cwd=/xyz

2nd step I test a script using that command with the same result OK = bash civicron_2.sh { "is_error": 0, "version": 3, "count": 1, "id": "processed", "values": { "processed": 0 } }

3nd step, I created the cron rule in Hostinger panel (every 30 minutes) = 0,30 * * * * /usr/bin/php /xyz/abcd/civicron_2.sh

But finaly CiviCRM UI says : "no cron job is running" and the only way I succed to run Job is manually on the CiviCRM UI.

I need advice to go further. BR hervé

6
  • I tried the wp-cli methode with the same result = -bash-4.1$ /xzy/wp-content/plugins/civicrm/civicrm/bin/wp-cli.phar --user=abcd --url=cycloclubbreuillet.fr --cwd=/xzy civicrm api job.execute auth=0 Array ( [is_error] => 0 [version] => 3 [count] => 1 [values] => 1 )
    – rv91530
    Dec 31 '20 at 8:51
  • You'll need to figure out where the error is being captured. Since it looks like you're using the system cron, the error will likely be in /var/log/syslog. However, since you have a hosted account, I'm not really sure exactly where. I am confident however, that there will be useful information from cron in the log.
    – kapn
    Dec 31 '20 at 13:48
  • I reply to myself to explain the first part of my solution: the current working directory was incorrect. Using wp-cli methode the parametre of --cwd= must not be the directory where index.php of the website is located (in my case /home/u781989671/public_html/) but the directory where all directories of the website are located (in my case /home/u781989671/) Now, when I run the new script in command-line PuTTY, I can see in UI CiviCRM that cron has been executed. The second part of the solution has to be found with suport Hostinger. I created a rule in UI Hostinger but noting happens.
    – rv91530
    Dec 31 '20 at 14:58
  • Ok, I solve the second part of the solution: I have to put the command directly in the Hostinger cron panel and not the path to file including the command. best regards rv
    – rv91530
    Dec 31 '20 at 16:44
  • CiviCRM will tell you "cron is not running" unless your cron calls "Job.execute". Calling a specific job like "Job.process_mailing" is OK, but it will not appear in the Scheduled Jobs Log and CiviCRM will not see it as "cron is running". Jan 2 at 19:12
2

In order to close this post, I'll explain the solution. There were 2 mistakes: 1/ the parametre cwd= (current working directory) was incorrect. 2/ the way I use UIHostinger for cron was incorect.

My solution is: 0,30 * * * * /usr/bin/php /home/u781989671/public_html/wp-content/plugins/civicrm/civicrm/bin/cv.phar api job.execute --user=myuser --cwd=/home/u781989671/public_html

best regards, rv

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.