Mautic Community Forums

Complete List of Cron Jobs for Crontab

Hey dev team,



I need complete list of all cron jobs that I need to configure in Crontab. This will enable Mautic to run quite effectively.

Please help with this.

Hey dev team,

I need complete list of all cron jobs that I need to configure in Crontab. This will enable Mautic to run quite effectively.
Please help with this.

Hi!

You can find those here:
https://www.mautic.org/getting-started

and here:
http://mautic.org/docs/setup/index.html

TL;DR

Updating Lead Lists

php /path/to/mautic/app/console mautic:leadlists:update --env=prod
Update Campaigns

php /path/to/mautic/app/console mautic:campaigns:update --env=prod
Execute Campaign Actions

php /path/to/mautic/app/console mautic:campaigns:trigger --env=prod
Sending Email

php /path/to/mautic/app/console mautic:email:process --env=prod

Hope that helps :slight_smile:
David

1 Like

Thank you so much David!

Added following to my Crontab:

*/1 * * * * php /path/to/mautic/app/console mautic:leadlists:update --env=prod
*/1 * * * * php /path/to/mautic/app/console mautic:campaigns:update --env=prod
*/1 * * * * php /path/to/mautic/app/console mautic:campaigns:trigger --env=prod
*/1 * * * * php /path/to/mautic/app/console mautic:email:process --env=prod

1 Like

Is there an additional cron job for web push notifications?

Out of curiosity, what does the --env=prod argument actually do? I find that this works with or without that added at the end.

[quote]
mbrinson Nov 8

Out of curiosity, what does the --env=prod argument actually do? I find that this works with or without that added at the end.[/quote]

Yes, I second that question, what is the –env=prod argument for? Please explain. Thanks.

Question from a newbie:

e.g. in the cron job
/1 * * * * php /path/to/mautic/app/console mautic:leadlists:update --env=prod
what do you need to change?

Am I right in thinking that “/path/to/mautic/app” needs to be changed to the correct path on your server?

After working with Mautic for almost 2 weeks, I have only just come to this conclusion, as I’ve just realised my cron jobs aren’t working. BUT NOWHERE IN THE DOCUMENTATION DOES IT SAY THAT THESE PARAMETERS NEED TO BE CHANGED!

So I’ve simply kept the “/path to/mautic/app” in the cron job path in cPanel.

It would make sense to someone experienced in coding and scripting, but it certainly isn’t common sense. It might explain why the forum here is strewn with people with cron problems and people have to post videos on YouTube to explain how to do it properly (which is how I found out). My assumption was that these parameters were automatically mapped to the folders in your server, given that you’d already told Mautic where to install the files.

Common sense would involve including a line in the documentation that said something on the lines of “You will have to replace “/path/to/mautic” with the path to the mautic installation on your server” followed by an example. How hard can that be?

To be honest, though, your comment is helpful because it suggests to me that Mautic probably isn’t for me. If I have to spend countless hours configuring settings that are “common sense” to most Mautic users, I’m in the wrong place!

@charlescorn I hear your frustration. I think this is also representative of the growing pains with Mautic. Many of the early adopters are already quite “tech-savvy”, so things that seem obvious to them may not be obvious at all to someone who just has a marketing background and is looking for great software.

Of course, folks like @MxyzptlkFishStix are much appreciated and much needed because they are generous with their time and knowledge and help answer questions, but as I mentioned – there can be a knowledge gap.

Self-hosted software tends to require more hands-on work, but there’s always free and paid Mautic Cloud. I think if Mautic is really going to grow, we (the community) will need to continue to work on making Mautic as accessible as possible for non-technical marketers and newbies.

*/1 * * * * php /var/www/html/app/console mautic:leadlists:update --env=prod
*/1 * * * * php /var/www/html/app/console mautic:campaigns:update --env=prod
*/1 * * * * php /var/www/html/app/console mautic:campaigns:trigger --env=prod
*/1 * * * * php /var/www/html/app/console mautic:email:process --env=prod

[quote=1604:@ankitpr89]Hey dev team,

I need complete list of all cron jobs that I need to configure in Crontab. This will enable Mautic to run quite effectively.
Please help with this.[/quote]

thats wrong answer actually

bellow - ok

*/1 * * * * php /var/www/html/app/console mautic:leadlists:update --env=prod */1 * * * * php /var/www/html/app/console mautic:campaigns:update --env=prod */1 * * * * php /var/www/html/app/console mautic:campaigns:trigger --env=prod */1 * * * * php /var/www/html/app/console mautic:email:process --env=prod

aaand not only that
we need to start each cron job with other time

so

1-59/20 * * * * php /var/www/html/app/console mautic:leadlists:update --env=prod 5-59/20 * * * * php /var/www/html/app/console mautic:campaigns:update --env=prod 10-59/20 * * * * php /var/www/html/app/console mautic:campaigns:trigger --env=prod 15-59/20 * * * * php /var/www/html/app/console mautic:email:process --env=prod

[quote=23179:@a1exe1]aaand not only that
we need to start each cron job with other time

so

1-59/20 * * * * php /var/www/html/app/console mautic:leadlists:update --env=prod 5-59/20 * * * * php /var/www/html/app/console mautic:campaigns:update --env=prod 10-59/20 * * * * php /var/www/html/app/console mautic:campaigns:trigger --env=prod 15-59/20 * * * * php /var/www/html/app/console mautic:email:process --env=prod[/quote]

Please are those commands really right?
I AM asking because It is not the same as the Inês presented at the documentation.

Running Mautic on your own server is no easy task. It is almost a necessity to have command line UNIX experience to properly setup and especially debug when things go sideways.

It really needs a WARNING: If any of this is greek to you, get a free account at mautic.com on the download page.

Typically I run Mautic on Ubuntu 16.04 LTS and like to log the output to /tmp, so mine looks like:

0,15,30,45 * * * * sudo -u www-data /usr/bin/php /var/www/html/app/console mautic:broadcasts:send 2>&1 >> /tmp/mautic.broadcasts.send.txt 1,16,31,46 * * * * sudo -u www-data /usr/bin/php /var/www/html/app/console mautic:segments:update 2>&1 >> /tmp/mautic.segments.update.txt 2,17,32,47 * * * * sudo -u www-data /usr/bin/php /var/www/html/app/console mautic:campaigns:rebuild 2>&1 >> /tmp/mautic.campaings.rebuild.txt 3,18,33,48 * * * * sudo -u www-data /usr/bin/php /var/www/html/app/console mautic:campaigns:trigger 2>&1 >> /tmp/mautic.campaigns.trigger.txt 4,19,34,49 * * * * sudo -u www-data /usr/bin/php /var/www/html/app/console mautic:emails:send 2>&1 >> /tmp/mautic.emails.send.txt 5,20,35,50 * * * * sudo -u www-data /usr/bin/php /var/www/html/app/console mautic:emails:fetch 2>&1 >> /tmp/mautic.emails.fetch.txt 7 * * * * sudo -u www-data /usr/bin/php /var/www/html/app/console mautic:iplookup:download 2>&1 >> /tmp/mautic.iplookup.download.txt 9,24,39,54 * * * * sudo -u www-data /usr/bin/php /var/www/html/app/console mautic:social:monitoring 2>&1 >> /tmp/mautic.social.monitoring.txt

PS - I run cron under the root user, ergo, the sudo -u ww-data command that precedes the /usr/bin/php.

last cron job

0,15,30,45 * * * * root /usr/bin/php /var/www/html/app/console mautic:webhooks:process 2>&1 >> /var/www/html/tmp/mautic.webhooks.txt 2,12,22,32,42,52 * * * * root /usr/bin/php /var/www/html/app/console mautic:segments:update 2>&1 >> /var/www/html/tmp/mautic.segments.txt 3,13,23,33,43,53 * * * * root /usr/bin/php /var/www/html/app/console mautic:campaigns:rebuild 2>&1 >> /var/www/html/tmp/mautic.campaings.rebuild.txt 4,14,24,34,44,54 * * * * root /usr/bin/php /var/www/html/app/console mautic:campaigns:trigger 2>&1 >> /var/www/html/tmp/mautic.campaigns.trigger.txt */1 * * * * root /usr/bin/php /var/www/html/app/console mautic:emails:send 2>&1 >> /var/www/html/tmp/mautic.emails.send.txt 5 0 * * * root /usr/bin/php /var/www/html/app/console mautic:email:fetch 2>&1 >> /var/www/html/tmp/mautic.emails.fetch.txt 6 0 * * * root /usr/bin/php /var/www/html/app/console mautic:iplookup:download 2>&1 >> /var/www/html/tmp/mautic.iplookup.txt 7,17,27,37,47,57 * * * * root /usr/bin/php /var/www/html/app/console mautic:social:monitoring 2>&1 >> /var/www/html/tmp/mautic.social.monitoring.txt 1,16,31,46 * * * * root /usr/bin/php /var/www/html/app/console mautic:broadcasts:send 2>&1 >> /var/www/html/tmp/mautic.broadcasts.send.txt

This is my crontab running on:
mautic v2.11.0 linux x64 installer on debian 8 bitnami Virtual Machine image, VMware .ova:
https://bitnami.com/redirect/to/166903/bitnami-mautic-2.11.0-0-r01-linux-debian-8-x86_64.ova

0,15,30,45 * * * * sudo php /opt/bitnami/apps/mautic/htdocs/app/console mautic:import -l 1000 --no-interaction --no-ansi 2>&1 >> /opt/bitnami/apps/mautic/htdocs/app/logs/mautic.import.txt 1,16,31,46 * * * * sudo php /opt/bitnami/apps/mautic/htdocs/app/console mautic:segments:update --no-interaction --no-ansi 2>&1 >> /opt/bitnami/apps/mautic/htdocs/app/logs/mautic.segments.update.txt 2,17,32,47 * * * * sudo php /opt/bitnami/apps/mautic/htdocs/app/console mautic:campaigns:rebuild --no-interaction --no-ansi 2>&1 >> /opt/bitnami/apps/mautic/htdocs/app/logs/mautic.campaigns.rebuild.txt 3,18,33,48 * * * * sudo php /opt/bitnami/apps/mautic/htdocs/app/console mautic:campaigns:trigger --no-interaction --no-ansi 2>&1 >> /opt/bitnami/apps/mautic/htdocs/app/logs/mautic.campaigns.trigger.txt 4,19,34,49 * * * * sudo php /opt/bitnami/apps/mautic/htdocs/app/console mautic:emails:send --no-interaction --no-ansi 2>&1 >> /opt/bitnami/apps/mautic/htdocs/app/logs/mautic.emails.send.txt 5,20,35,50 * * * * sudo php /opt/bitnami/apps/mautic/htdocs/app/console mautic:emails:fetch --no-interaction --no-ansi 2>&1 >> /opt/bitnami/apps/mautic/htdocs/app/logs/mautic.emails.fetch.txt 6,21,36,51 * * * * sudo php /opt/bitnami/apps/mautic/htdocs/app/console mautic:broadcasts:send --no-interaction --no-ansi 2>&1 >> /opt/bitnami/apps/mautic/htdocs/app/logs/mautic.broadcasts.send.txt 9,24,39,54 * * * * sudo php /opt/bitnami/apps/mautic/htdocs/app/console mautic:social:monitoring --no-interaction --no-ansi 2>&1 >> /opt/bitnami/apps/mautic/htdocs/app/logs/mautic.social.monitoring.txt 7 * * * * sudo php /opt/bitnami/apps/mautic/htdocs/app/console mautic:iplookup:download --no-interaction --no-ansi 2>&1 >> /opt/bitnami/apps/mautic/htdocs/app/logs/mautic.iplookup.download.txt

& the others etc…

Makre sure the are owned by the bitnami user so writable by cron:

Check logs for results. e.g:

[2017-12-01 10:45:01] Import 2 with 51 rows is starting.
0/51 [>---------------------------] 0%
5/51 [==>-------------------------] 9%
10/51 [=====>----------------------] 19%
15/51 [========>-------------------] 29%
20/51 [==========>-----------------] 39%
25/51 [=============>--------------] 49%
30/51 [================>-----------] 58%
35/51 [===================>--------] 68%
40/51 [=====================>------] 78%
45/51 [========================>—] 88%
50/51 [===========================>] 98%
51/51 [============================] 100%
[2017-12-01 10:45:05] 51 lines were processed, 50 items created, 0 items updated, 1 items ignored in 3.73

1 Like