Cron jobs are not triggering automatically

Your software
My PHP version is 7.4.21 :
My MySQL/MariaDB version is (delete as applicable): MySQL/MariaDB version:5.7.34

My problem is :I am first time using mautic.I have setup everything correctly and everything is working perfect.But i am facing issues with cron jobs.Cron jobs are not getting triggered automatically.

Steps I have tried to fix the problem :
1.Clear Cache
2.Cache warmup
3.Check file permissions
4.Run Cronjobs on command line,all are working.But not able to triggered automatically from crontab.

Hi, can you share your settings, maybe we can spot an error.

Hey @joeyk, I am also facing same issue on A2Hosting Server.

1,16,31,46 * * * * php /home/dyathink/crm.dyathink.com/bin/console mautic:segments:update --batch-limit=900 --env=prod
5,20,35,50 * * * * php /home/dyathink/crm.dyathink.com/bin/console mautic:campaigns:update --env=prod
10,25,40,55 * * * * php /home/dyathink/crm.dyathink.com/bin/console mautic:campaigns:trigger --batch-limit=100 --env=prod
*/5 * * * * php /home/dyathink/crm.dyathink.com/bin/console mautic:email:fetch --env=prod
13,28,43,58 * * * * php /home/dyathink/crm.dyathink.com/bin/console mautic:emails:send --env=prod

Here are my cronjob settings. If I run them manually, It all works fine. but automatically its not running or better word will be working. as Hosting Support replied that cronjobs are running as scheduled.

Looking forward for guidance on this

Hello!
You are running cron every 15 min (which is a good practice if you have limited resources)
What do tou mean by not working? Are segments not updated?

I fixed this issue @joeyk @designedbyks by adding

php directory instead of just php in cron job command.

1,16,31,46 * * * * /usr/local/bin/php /home/userdirectory/domain.com/bin/console mautic:segments:update --batch-limit=900 --env=prod > /dev/null 2>&1
5,20,35,50 * * * * /usr/local/bin/php /home/userdirectory/crm.dyathink.com/bin/console mautic:campaigns:update --env=prod > /dev/null 2>&1
10,25,40,55 * * * * /usr/local/bin/php /home/userdirectory/domain.com/bin/console mautic:campaigns:trigger --batch-limit=100 --env=prod > /dev/null 2>&1
*/15 * * * * /usr/local/bin/php /home/userdirectory/domain.com/bin/console mautic:email:fetch --env=prod > /dev/null 2>&1
13,28,43,58 * * * * /usr/local/bin/php /home/userdirectory/domain.com/bin/console mautic:emails:send --env=prod >/dev/null 2>&1

This fixed the issue for me, Thanks

2 Likes

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.