3

I have a scheduled job, iATS Payments Recurring Contributions, set to run daily. Currently, the job fires off right after midnight every day. However, we need it to happen later -- say, around 3am.

Cron runs drush civicrm-api job.execute twice an hour, triggering any scheduled jobs that are due to run.

I know I can create a separate cron job at the desired time for this particular iATS scheduled job. However the iATS job may still get swept up by the catch-all civicrm-api job.execute and run at a different time, right?

  • 1
    You could disable the job and then add another cron job with drush where you replace job.execute by the entity and action of the specific job – Jaap Jansma - CiviCooP Dec 3 '15 at 22:12
  • Thank. So the enabled/disabled status isn't respected when calling the job directly via the API? – Noah Miller Dec 3 '15 at 23:46
  • I would assume so – Jaap Jansma - CiviCooP Dec 4 '15 at 9:41
  • Is there a way to call a specific job via a URL? – Yossi Sep 9 '16 at 19:44
  • If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review – William Mortada Sep 12 '16 at 10:26
5

The solution is to exclude the iATS job from the "normal catch all" cronjob (so don't put it to run automatically daily)

Then add a line on your cron to run it at 3 am

0 3 * * * www-data nice -n19 /usr/bin/drush -u 1 -r $drupal_root civicrm-api job.whatever-iats-name auth=0 -y

You will need to find what is the name of the iats api job, and put it in the line

and voila, you should have it working now at 3 am

  • Yes, and two caveats: 1. the recurring contribution job has a managed record, so in some versions it can re-enable itself. 2. iATS runs it own recurring contributions at 3am PST, so you likely don't want to choose that exact time, though it might be okay. – Alan Dixon Jan 14 '16 at 14:41
  • This is indeed the solution we're using, and it works. Just a note, though: individual jobs run directly from cron won't leave an entry in the Job Log. I decided to have the cron job call an intermediate shell script, which logs the job's result to the log. Also, this solution is confusing to our civi admin, because the job is "disabled" on the "scheduled jobs" page, and yet it still runs (through the special 3am cron job I created). I've edited the title/description of the job on that page to make the situation clearer for the admin. Thanks for the iATS-specific tips, @AlanDixon – Noah Miller Apr 4 '16 at 6:03
  • If you want to sue the CURL method, the curl looks like this "example.com/sites/all/modules/civicrm/bin/…"' – Tony Horrocks Apr 30 at 10:46
0

If you want to sue the CURL method, the curl looks like this

https://example.com/sites/all/modules/civicrm/bin/cron.php?name=admin&pass=yourpass&key=site_key&job=mail_report&instanceId=38

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.