Mautic Cron Job

My first email with mautic didn’t go as planned.  Once again waking up I looked at the results and nothing had been sent.  The problem this time however was of a technical nature.

Setting up Cron Jobs

My crontab now looks roughly like this.  You will need to change the paths to match your mautic install.

* * * * * php /var/www/html/mautic/app/console mautic:segments:update

 */4 * * * * php /var/www/html/mautic/app/console mautic:campaigns:rebuild

 */5 * * * * php /var/www/html/mautic/app/console mautic:campaigns:trigger

 0,30 * * * * php /var/www/html/mautic/app/console mautic:emails:send

15 5 * * 5 /opt/letsencrypt/letsencrypt-auto renew >> /var/log/le-renew.log


These cron jobs are all necessary for mautic to do it’s job.  The first syncs email addresses in all the segments, rerunning the filters.  The second updates any campaigns, and the third, which I was was missing, triggers events in campaigns.  The fourth is only necessary if you queue emails.  You may want to do that if you have outgoing mail restrictions on your hosting, but linode does not. I put it there anyway for future proofing.

The last job in my crontab will auto renew my lets encrypt certs.  To add these to your cron jobs just run the command crontab -e.  It will ask you to select an editor (vim ftw but you can use nano if you want).


Go ahead and copy paste one of those commands into a terminal and make sure it runs.  In my case it didn’t, since I didn’t have permission to write everything in that directory.  Everything in there belonged to both group and user www-data (the user php executes as).  This may have been some mistake I made during installation, but nonetheless if  you run across it here is what I did:

cd /var/www/html
sudo chmod -R g+w mautic
sudo usermod -aG www-data breandan

Leave a Reply

Your email address will not be published. Required fields are marked *