Hello @Joeyk,
Thank you once again for your support. You are one of the main reasons I continue using Mautic. Your guidance, insights from ChatGPT and some posts by Yosu Cadilla (who, for reasons I am unaware of, appears to be banned from the community), has been incredibly helpful.
After following your post Mautic 5 Cronjobs and conducting several hours of research, I believe I have found the solution to my issues.
I encountered two main problems:
- File Permissions: After migrating my Mautic instance to a new server, I realized I had been running cron jobs as the root user. I’ve since updated this to run cron jobs under the
www-data
user, which resolved some issues.
- Blocked Tables: I noticed that some database tables were blocked, causing additional errors (because of the reason you mention above).
Thanks to your advice, I am also optimizing the cron jobs. However, I am concerned about the variability in server load. For instance, if we plan to send a large volume of emails on a specific day, this could lead to performance problems. While upgrading to a more powerful server might be an option to speed up tasks, I am unsure if it would be a cost-effective solution.
Currently they look like this:
*/15 * * * * www-data php /var/www/mautic/bin/console messenger:consume email --time-limit=870
# I runned the following 3 and measured they took less than 1 minute to complete. Each of them happen every three minutes, hopefully this will avoid blocked tables.
0,9,18,27,36,45,54 * * * * www-data php /var/www/mautic/bin/console mautic:segments:update --batch-limit=2700
3,12,21,30,39,48,57 * * * * www-data php /var/www/mautic/bin/console mautic:campaigns:rebuild --batch-limit=900
6,15,24,33,42,51 * * * * www-data php /var/www/mautic/bin/console mautic:campaigns:trigger --campaign-limit=150
* * * * * www-data php /var/www/mautic/bin/console mautic:broadcasts:send --batch=5 --limit=500
Additionally, I plan to purchase the Command Monitor plugin, which I believe will help prevent similar issues in the future. I realized something was wrong after reviewing a report showing 24,000 emails sent but 0 reads a week later. The campaign:trigger
cron job had been blocked, resulting in customers receiving their Christmas message in January—a situation that could have been avoided.
I wanted to share my experience and solutions here in case it helps someone else. For Mautic to truly succeed, it needs to be both user-friendly and cost-effective.
I think that to make Mautic succeed in its vision, it has to be easy-to-use and Cost-Effective. My experience is far from easy-t-use until today… Is it possible to create a code that calculates, monitors and sets CronJobs and server usage at the same time?