Hi Mauticians,
As many of us have experienced problems with firing off campaigns and making sure they get sent at the correct times, we have been working pretty hard to automate this process and have finally finished stage 1 of this which we will hopefully release soon to the community. However moving to the next stage we could really do with a little input and understanding from the community on certain issues.
Firstly I will explain what Stage 1 contains.
Our main pain point was a fairly large client that schedules campaigns based on a specific date and time and due to the high number of campaigns they run (they have over 600) many were not being triggered correctly, so stage 1 was born:
We look through the DB and extract all campaigns that have a date/time based action/condition.
We then check the crontab to see if there is a cronjob written for that specific event.
If there is not a cronjob written for that event we write it and inject it into the crontab ( so will be something like Mautic:campaigns:trigger -I 632)
If there is a cronjob written for that campaign we then check if it has been modified since the script last ran (currently set to an interval of 15 minutes) and if it has been modified, we delete the current cronjob for that campaign from the crontab and build a new cronjob line and inject into the crontab.
Script is working like a charm and client is very happy.
Now moving onto the next stage, here we are looking at the different ‘event_types’ and how to deal with them.
- Interval Events (relative time period)
– Minutes
– Hours
– Days/Months/Years
— Scheduled at specific time
— Scheduled between two hours
— Scheduled only on selected day of week
So the question is here what to do ?
Would it be enough to maybe ignore all of these and have a crontab running on campaigns:trigger every 15 minutes for all campaigns ? [Stage 1 is implemented with --force]
or would we want to create separate cronjobs for each Interval type, or each campaign with the -i flag.
Example:
For immediate actions to have for each campaign a line in the crontab
-
-
-
-
- php /var/www/mautic/bin/console mautic:campaigs:trigger -i 645
-
-
-
-
-
-
-
- php /var/www/mautic/bin/console mautic:campaigs:trigger -i 646
-
-
-
-
-
-
-
- php /var/www/mautic/bin/console mautic:campaigs:trigger -i 648
-
-
-
And then on specific times it is easier and specific days of the week is also kind of logical to define.
Or would the above example of cronjobs be heavy on the system or could cause some issues?
Looking forward to the discussion to follow.
Mike