Mautic Community Forums

Cron Job staggering time

My Mautic version is: 3.1.2

I’m wanting to know a little more information on staggering the following three commands required by Mautic.

From the documentation:
Cron jobs | Mautic Community Documentation
It is HIGHLY recommended that you stagger the following required jobs so as to not run the exact same minute.

For instance:

  • 0,15,30,45 <— mautic:segments:update
  • 5,20,35,50 <— mautic:campaigns:update
  • 10,25,40,55 <— mautic:campaigns:trigger

We are actually running Mautic on windows and as a result are using scheduled tasks to run the above three as bat commands. It all seems to be working as expected, however the worry is that with the break between segments update and campaign triggers couldn’t changes be missed pretty easily?

For example a campaign is set to run for Segment 1 and have Steps 1,2,3 (each sending an email). Now if a user does something like visits Page 1 I want them removed from the campaign and no more emails to be sent. User 1 is part of that segment during the update, but then visits Page 1 before the next time is scheduled for the segment update. That won’t be seen until it comes back to it in 15 minutes but by that time the campaigns update and campaigns triggers have already been run and they will be getting a new Email sent to them if it’s the right time in the campaign correct?

This might not happen often as it would have to be the right time of the campaign to trigger the event as well, but given enough Campaigns and Users I could see this causing some issues.

I created a scheduled task that runs all the tasks together after one another and it seems to work. Does the main reason for the stagger have to do with system load or are their other reasons? I know this still isn’t a perfect solution because a user could technically visit a page after their segment was processed but before the campaign trigger event, but the odds of that are much less if there isn’t a 10 minute delay between the two.

Hi, there was a presentation on cronjobs at the Mautic Lagos Meetup. One topic was how to run cronjobs every 30 seconds and how to measure ideal running time.

Good luck

Thank you this is perfect!