The tasks in campaigns are pending

Your software
Linux ubuntu
My Mautic version is: 2.15.3
My PHP version is: 7.2.24

Your problem
Hello guys.
I’m a newbie and I installed Mautic recently and I can’t figure out how get my campaign working.
1- I create a segment
2- I create a campaign with that segment and I set next step as send email
3- Then I create a contact (for testing) and add to the segment
but it doesn’t send the emails, when I visit the campaign, go to task tap, I see the sending email is pending

I have read every article on cron job available on the internet still no idea what I am doing wrong. here are my cron job. Please help me if you can. thanks.

15 * * * * root php /var/www/html/app/console mautic:webhooks:process
10 * * * * root php /var/www/html/app/console mautic:leadlists:update
10 * * * * root php /var/www/html/app/console mautic:campaigns:update
10 * * * * root php /var/www/html/app/console mautic:campaigns:trigger

          • root php /var/www/html/app/console mautic:email:process
          • php /var/www/html/console mautic:emails:send
          • php /var/www/html/app/console mautic:messages:send

Have you connected an email service?

yes, I use sendgrid API - I can send segmented emails (manually). but nothing works automatically/

Ok, i can also see that your crons all run at the same time, it might cause them to overlap. try to stagger them and see if it helps:

0,15,30,45* * * * <— mautic:segments:update
5,20,35,50* * * * <— mautic:campaigns:update
10,25,40,55* * * * <— mautic:campaigns:trigger

or even chain them:
php /var/www/html/app/console mautic:leadlists:update && php /var/www/html/app/console mautic:campaigns:update && php /var/www/html/app/console mautic:campaigns:trigger

thank you so much!
should be like
0,15,30,45 * * * * php /var/www/html/app/console mautic:leadlists:update && php /var/www/html/app/console mautic:campaigns:update && php /var/www/html/app/console mautic:campaigns:trigger
or:
0,15,30,45 * * * * php /var/www/html/app/console mautic:leadlists:update && php /var/www/html/app/console mautic:campaigns:update && php /var/www/html/app/console mautic:campaigns:trigger
or

          • php /var/www/html/app/console mautic:leadlists:update && php /var/www/html/app/console mautic:campaigns:update && php /var/www/html/app/console mautic:campaigns:trigger

If you chain them, it can be like this:
*/5 * * * * php /var/www/html/app/console mautic:leadlists:update && php /var/www/html/app/console mautic:campaigns:update && php /var/www/html/app/console mautic:campaigns:trigger

nw

still not working, I don’t know why :disappointed: I even created a new campaign

Is there anything in the error log? did you try to run the crons manually?

yes it works manually - just trying to find out a way to get work with cron job


I get an enteral mail like this

finally I found the solution! I had to add –env=prod to each command

2 Likes

Hey there - I’m having the same issue. Could you show me how you set up your Cron jobs with [quote=“john67, post:11, topic:15440”]
–env=prod
[/quote] appended to each command?

That would be super helpful!

For reference, my Cron’s are setup now as:

0,15,30,45 * * * * su daemon -s /bin/sh -c “/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:segments:update” #mautic-segments-cron –env=prod

*/3 * * * * su daemon -s /bin/sh -c “/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:campaigns:rebuild” #mautic-campaings-rebuild-cron –env=prod

10,25,40,55 * * * * su daemon -s /bin/sh -c “/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:campaigns:trigger” #mautic-campaigns-trigger-cron –env=prod

*/1 * * * * su daemon -s /bin/sh -c “/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:emails:send” #mautic-email-send-cron –env=prod

*/10 * * * * su daemon -s /bin/sh -c “/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:webhooks:process” #mautic-webhooks-cron –env=prod

*/15 * * * * su daemon -s /bin/sh -c "/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:social:monitoring” #mautic-social-mon-cron –env=prod

*/1 * * * * su daemon -s /bin/sh -c "/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:broadcasts:send --channel=sms –env=prod

5,20,35,50 * * * * su daemon -s /bin/sh -c “/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:campaigns:update” –env=prod