# The tasks in campaigns are pending

**URL:** <https://forum.mautic.org/t/the-tasks-in-campaigns-are-pending/15440>\
**Category:** Product Support\
**Created:** [July 29, 2020, 2:15pm UTC](https://forum.mautic.org/t/the-tasks-in-campaigns-are-pending/15440 "2020-07-29T14:15:42Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![john67](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/john67/32/636_2.png) [@john67](https://forum.mautic.org/u/john67)\
**Post date:** [July 29, 2020, 2:15pm UTC](https://forum.mautic.org/t/the-tasks-in-campaigns-are-pending/15440/1 "2020-07-29T14:15:42Z")

</div>

**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

 ![pending](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/6/66a40b86eb7066855c7236b1665af5329a575410.png)

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

---

<div class="post-metadata">

**Author:** ![OmerGafny](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/omergafny/32/1759_2.png) [@OmerGafny](https://forum.mautic.org/u/OmerGafny)\
**Post date:** [July 29, 2020, 2:26pm UTC](https://forum.mautic.org/t/the-tasks-in-campaigns-are-pending/15440/2 "2020-07-29T14:26:23Z")

</div>

Have you connected an email service?

---

<div class="post-metadata">

**Author:** ![john67](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/john67/32/636_2.png) [@john67](https://forum.mautic.org/u/john67)\
**Post date:** [July 29, 2020, 2:58pm UTC](https://forum.mautic.org/t/the-tasks-in-campaigns-are-pending/15440/3 "2020-07-29T14:58:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![OmerGafny](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/omergafny/32/1759_2.png) [@OmerGafny](https://forum.mautic.org/u/OmerGafny)\
**Post date:** [July 29, 2020, 3:24pm UTC](https://forum.mautic.org/t/the-tasks-in-campaigns-are-pending/15440/4 "2020-07-29T15:24:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![john67](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/john67/32/636_2.png) [@john67](https://forum.mautic.org/u/john67)\
**Post date:** [July 29, 2020, 5:13pm UTC](https://forum.mautic.org/t/the-tasks-in-campaigns-are-pending/15440/5 "2020-07-29T17:13:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![OmerGafny](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/omergafny/32/1759_2.png) [@OmerGafny](https://forum.mautic.org/u/OmerGafny)\
**Post date:** [July 29, 2020, 5:21pm UTC](https://forum.mautic.org/t/the-tasks-in-campaigns-are-pending/15440/6 "2020-07-29T17:21:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![john67](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/john67/32/636_2.png) [@john67](https://forum.mautic.org/u/john67)\
**Post date:** [July 29, 2020, 7:09pm UTC](https://forum.mautic.org/t/the-tasks-in-campaigns-are-pending/15440/7 "2020-07-29T19:09:37Z")

</div>

![nw](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/a/a73482d4fc33fd01e0653d4016e0791ac8c174d2.png)

 ![root](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/8/8ec6bbc1d8fe56be7971049ad54f3865e3c29236.png)

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

---

<div class="post-metadata">

**Author:** ![OmerGafny](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/omergafny/32/1759_2.png) [@OmerGafny](https://forum.mautic.org/u/OmerGafny)\
**Post date:** [July 30, 2020, 7:39am UTC](https://forum.mautic.org/t/the-tasks-in-campaigns-are-pending/15440/8 "2020-07-30T07:39:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![john67](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/john67/32/636_2.png) [@john67](https://forum.mautic.org/u/john67)\
**Post date:** [July 30, 2020, 12:15pm UTC](https://forum.mautic.org/t/the-tasks-in-campaigns-are-pending/15440/9 "2020-07-30T12:15:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![john67](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/john67/32/636_2.png) [@john67](https://forum.mautic.org/u/john67)\
**Post date:** [July 30, 2020, 12:23pm UTC](https://forum.mautic.org/t/the-tasks-in-campaigns-are-pending/15440/10 "2020-07-30T12:23:03Z")

</div>

![err](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/d/d968f40a9bbd67edb1f60b6c6bb479ee3f819ec3.png)  
I get an enteral mail like this

---

<div class="post-metadata">

**Author:** ![john67](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/john67/32/636_2.png) [@john67](https://forum.mautic.org/u/john67)\
**Post date:** [July 30, 2020, 1:23pm UTC](https://forum.mautic.org/t/the-tasks-in-campaigns-are-pending/15440/11 "2020-07-30T13:23:43Z")

</div>

> [@OmerGafny](#):
>
> 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

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

---

<div class="post-metadata">

**Author:** ![evanr](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/evanr/32/1095_2.png) [@evanr](https://forum.mautic.org/u/evanr)\
**Post date:** [May 9, 2021, 12:49am UTC](https://forum.mautic.org/t/the-tasks-in-campaigns-are-pending/15440/12 "2021-05-09T00:49:41Z")

</div>

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
