Adjust cron jobs for Mautic... is it possible?
-
Hi,
as the standard setup regarding cron jobs is not optimal... how much can I adjust an installation in cloudron without breaking it?That's the reason and possible solution: https://twentyzen.com/en/think/faq-items/start-mautic-cron-jobs-in-sequence/
So I would need to add an own individual shell script file and call this instead of the individual mautic commands.
-
Tried to understand what is written in the linked post, but not sure I am following the necessity of what they mention there.
For refrence in Cloudron the contab for mautic is https://git.cloudron.io/cloudron/mautic-app/-/blob/master/crontab.system.template?ref_type=heads
-
Thanks for the feedback, will rework this article as the next step.
The reason why this initial Mautic Setup is not used by us and other Mautic Partners: The staggered setting of making sure that the commands run in the right sequence:
- 0,15,30,45 * * * * (echo "==> cron: mautic:segments:update"; sudo -E -u www-data php /app/code/bin/console mautic:segments:update) > /proc/$(cat /var/run/crond.pid)/fd/1 2>&1
- 5,20,35,50 * * * * (echo "==> cron: mautic:campaigns:update"; sudo -E -u www-data php /app/code/bin/console mautic:campaigns:update) > /proc/$(cat /var/run/crond.pid)/fd/1 2>&1
- 10,25,40,55 * * * * (echo "==> cron: mautic:campaigns:trigger"; sudo -E -u www-data php /app/code/bin/console mautic:campaigns:trigger) > /proc/$(cat /var/run/crond.pid)/fd/1 2>&1
With that setup, the Marketing Automation needs at average 12,5 minutes, before a client gets a response from the system. Thats no acceptable, as it negatively impacts response rates and conversion rates. Just imagine, you want to get some information, fill in a form and don't get a response in a timely manner.
We reworked the cronjob setup to concatenate those commands in a shell script and run it - depending on the server speed and the load - every 1-3 minutes.
/PATHTOPHP/php /PATHTOMAUTIC/app/console mautic:segments:update && /PATHTOPHP/php /PATHTOMAUTIC/app/console mautic:campaigns:update & /PATHTOPHP/php /PATHTOMAUTIC/app/console mautic:campaigns:triggerSo in order to achieve that, I need to be able to
- disable the default cloudron cronjobs for mautic (will it be persistent across updates?) and
- run a custom shell script containing those commands instead (will this shell script stay there across updates?).
Hope this clarifies the reason behind it.
-
I am no mautic expert, so I can't fully follow this requirement still. However, have you seen https://docs.cloudron.io/apps/mautic/#custom-cron-jobs for custom cron jobs with mautic?
Ideally if this is something all mautic users in the end need (hopefully other can contribute to the discussion here) I guess it would be better to adjust the package cron then.
-
You can edit the
/app/data/crontab.systempatterns as you wish . See https://docs.cloudron.io/apps/mautic/#system-cron-jobs . I agree that mautic's flow of calling cron for everything is suboptimial. This is why the package made the patterns editable . In fact, for processing any task, the mautic way is to run a cronjob manually. -
You can edit the
/app/data/crontab.systempatterns as you wish . See https://docs.cloudron.io/apps/mautic/#system-cron-jobs . I agree that mautic's flow of calling cron for everything is suboptimial. This is why the package made the patterns editable . In fact, for processing any task, the mautic way is to run a cronjob manually.@girish said in Adjust cron jobs for Mautic... is it possible?:
You can edit the
/app/data/crontab.systempatterns as you wish . See https://docs.cloudron.io/apps/mautic/#system-cron-jobs . I agree that mautic's flow of calling cron for everything is suboptimial. This is why the package made the patterns editable . In fact, for processing any task, the mautic way is to run a cronjob manually.Will this file stay intact with every Mautic update via cloudron? Because I would then comment them out and completely replace them with custom cron jobs.
-
We have years long experience with mautic

Its important to help with a default cronjob setup. The one from the docs work, but its not optimal. I will help setting it up in a better way together with you, if you like.
For now it would be good, if the out of the box setup for cronjobs in cloudron could also be disabled. I did it by commenting out every line in the crontab.system - but will this be replaced again by an update or not? Its in the /app/data directory. So I think it will not?
I already changed my cronjob setup with a shell file. I trigger this every minute, in case its still running, it will be ignored. I will need to extend it by other optional cronjob tasks - maybe having even two or more scripts. One to run every minute (if server can handle it). And then some maintenance task that don't need to run that often.
Update - the current version can now be found at:
https://github.com/twentyZen/mautic-cronjobsMyself I'm not a script or Linux Professional. Probably that approach can be improved.
-
D dsp76 referenced this topic on
-
For instance - whats the php memory limit on cli? Is it the same limit as for the mautic instance overall?
-
D dsp76 referenced this topic on
-
We have years long experience with mautic

Its important to help with a default cronjob setup. The one from the docs work, but its not optimal. I will help setting it up in a better way together with you, if you like.
For now it would be good, if the out of the box setup for cronjobs in cloudron could also be disabled. I did it by commenting out every line in the crontab.system - but will this be replaced again by an update or not? Its in the /app/data directory. So I think it will not?
I already changed my cronjob setup with a shell file. I trigger this every minute, in case its still running, it will be ignored. I will need to extend it by other optional cronjob tasks - maybe having even two or more scripts. One to run every minute (if server can handle it). And then some maintenance task that don't need to run that often.
Update - the current version can now be found at:
https://github.com/twentyZen/mautic-cronjobsMyself I'm not a script or Linux Professional. Probably that approach can be improved.
hey @dsp76 thanks for sharing... so if I install this shell file to my Mautic installation on Cloudron, it'll speed up the cronjobs?
Unfortunately I'm unable to add an .env file because on Cloudron the app is a "read only filesystem"
-
@jordanurbs have you tried running the cronjob manually . https://docs.cloudron.io/apps/mautic/#system-cron-jobs ? Maybe it's erroring?
-
hey @dsp76 thanks for sharing... so if I install this shell file to my Mautic installation on Cloudron, it'll speed up the cronjobs?
Unfortunately I'm unable to add an .env file because on Cloudron the app is a "read only filesystem"
@jordanurbs you could put those in the /app/data folder which is writeable?
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login