How to implement cronjobs

Your software
My Mautic version is: 3.1.2
My PHP version is: 7.3
My Database type and version is: 5.7

Your problem
I’d like to know how and which cronjobs to implement? I installed Mautic on-premise on an Debian 10 virtual host running Apache 2.4
I know there i need to trigger some executions via CRON to let the system execute several tasks.
But what user should run it? Is it “root” or “www-data” or a special “mautic” user?
And how to add the lines into /etc/cron.d/… file? Those tables are very picky about what the task do and will also emit local emails if the execution outputs any results.

From the examples i took this kind of execution:
0,15,30,45 * * * * root /usr/bin/php /systems/mautic/htdocs/app/console mautic:segments:update 5,20,35,50 * * * * root /usr/bin/php /systems/mautic/htdocs/app/console mautic:campaigns:update 10,25,40,55 * * * * root /usr/bin/php /systems/mautic/htdocs/app/console mautic:campaigns:trigger 10,25,40,55 * * * * root /usr/bin/php /systems/mautic/htdocs/app/console mautic:messages:send 10,25,40,55 * * * * root /usr/bin/php /systems/mautic/htdocs/app/console mautic:emails:send

Hey

You can run cron as root or www-data.

Easiest way is to type in crontab -e

and check out this link for all the cronjob available and required: https://docs.mautic.org/en/setup/cron-jobs

Thanks mike, i’ve already seen this. But the way a user-crontab works is slightly different than in /etc/cron.d/ on the Linux side.
Running as www-data does not work (produces lot’s of errors), so i currently run them manually as root. But maybe root is a bit too highleved for this tasks?!

I run mine as root. Not sure about the pro’s or cons of it, but works for me :smiley:

Ok, i’ll do the same. Was just a bit unshure if that it the proposed way to do. Usually webapps written in PHP do not need that high access and most often running a webapp once as user and as root could end up in deadlocks because user can’t remove/overwrite things written by root.

So i suggest if running as www-data (my local Apache 2 user) is working, it was sufficient.