Mautic Community Forums

Cron jobs issue, fresh install

Your software - v2.16.5 (that’s what it says in the right bottom corner on the dashboard)

My PHP version is : 7.2.24-0ubuntu0.18.04.9
My MySQL/MariaDB version is (delete as applicable): MySQL/MariaDB version - mysqlnd 5.0.12

Updating/Installing Errors
I am (delete as applicable): Updating
Upgrading/installing via (delete as applicable) : Web

These errors are showing in the installer : none

These errors are showing in the Mautic log : none

Your problem
My problem is :
Only able to send emails immediately, queue is not working, it says the email has been sent, but I am not receiving it.

Steps I have tried to fix the problem :
I have followed the installation steps on your website for ubuntu 18.4, and after opening my dashboard it said update is available, so I clicked on that.

Now that I am unable to queue the emails I think it should be CRON jobs related, so I searched in the forum and looks like everyone has their console on -
/var/www/html/bin/console

but on my server it is on
/var/www/html/app/console for some reason. ( there is no bin folder)
Please help me troubleshoot it

This is the output of crontab -l

root@email1:/var/www/html# crontab -l
# Cron jobs for Mautic 2
#* * * * * php /var/www/html/app/console mautic:segments:update
#* * * * * php /var/www/html/app/console mautic:campaigns:update
#* * * * * php /var/www/html/app/console mautic:campaigns:trigger
#
# Cron jobs for Mautic 3
* * * * * php /var/www/html/bin/console mautic:segments:update
* * * * * php /var/www/html/bin/console mautic:campaigns:update
* * * * * php /var/www/html/bin/console mautic:campaigns:trigger

and this is the /etc/ctrontab


# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.


SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

 m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#




Thank you!!

hi there

in the more recent versions of Mautic console is sitting in /mautic/bin/console

Also I do not see that you have a cronjob to send queued messages.
you will need something like this
*/2 * * * * php7.4 /var/www/mautic/bin/console mautic:emails:send > /dev/null
This will trigger a send every two minutes for example

1 Like

Thank you for your answer, that’s strange why I didn’t get the newest version when doing a fresh install, and did an update on the dashboard.
Anyways, will try to set up CRON jobs manually and let you know.

Your PHP version is too low to get the newer version:

See Requirements - Mautic Community - this lists the minimum versions required.

There is a bug which means you won’t see newer versions:

We are fixing this so that you get alerted about a release being available but informing you about the PHP version being unsupported with this PR:

which is still in progress but we hope will ship with 4.1.

1 Like

In addition to what was mentioned by others, could you please tell us where you got the installation instructions from? In your post I saw:

I have followed the installation steps on your website for ubuntu 18.4

I’m curious where exactly you found those instructions :blush: Mautic 2.16 is rather old, as we’re already at Mautic 4. I have a feeling you got instructions from an older source (article or blog post) that we might need to update. Thanks in advance!

1 Like

I followed this guide - Secure Mautic Installation on a VPS in 2020 | Mauteam.org
and yes, it’s in fact quite old already… By any chance you have a newer guide I could follow on a fresh VPS? :slight_smile:
Thanks for the help!

Ah, thanks for sharing! @Yosu_Cadilla would you mind updating that article for Mautic 4? :+1:

For now @mindeswx, you can follow this article: Mautic 3 Installation on Ubuntu 20.04 with PHP 7.3 and MySQL 5.7 - that one is slightly newer, but also not updated for Mautic’s latest version. You can basically follow that article but with the following changes:

  • Install PHP 7.4 instead of 7.3 (replace php7.3 with php7.4 everywhere)
  • Install Mautic 4 instead of Mautic 3, so instead of wget https://github.com/mautic/mautic/releases/download/3.2.5/3.2.5.zip you can do wget https://github.com/mautic/mautic/releases/download/4.0.0/4.0.0.zip

Then you will be on the latest version right away :blush: Hope this helps! We’re working on making this process smoother for the future, but for now you should be able to get started with these steps.

Thank you very much, I have followed these installation steps on the new server, and now I am running Mautic 4 , unfortunately the queue still isn’t working with the provided CRON jobs
( https://mauteam.org/wp-content/uploads/2019/10/cron-jobs.txt)

However, now I can trigger the email to be sent with this command -
php7.4 /var/www/html/bin/console mautic:emails:send

Could someone please share what are the correct CRON jobs for mautic 4?

Thank you.

in the link you sent the cronjob is missing the one you are running manually

Cron jobs for Mautic 3

          • php /var/www/html/bin/console mautic:segments:update
          • php /var/www/html/bin/console mautic:campaigns:update
          • php /var/www/html/bin/console mautic:campaigns:trigger
            just add
            */3 * * * * php7.4 /var/www/html/bin/console mautic:emails:send
            or whatever frequency you want it to fire at.

Take note that the way the cronjob are set up above can be very heavy on the system as they are running every minute and not sure this is necessary.

Check out Crontab.guru - The cron schedule expression editor/1_** to understanding the intervals you may want

1 Like

Thank you @mikew , added that line to the CRON jobs and it’s working now.
However, I have noticed one strange thing, when sending messages immediately I am able to use “from” as my domain - xxx@pinkcreators.com
but when using the queue method I get the following error -
The from address does not match a verified Sender Identity. Mail cannot be sent until this error is resolved. Visit https://sendgrid.com/docs/for-developers/sending-email/sender-identity/ to see the Sender Identity requirements

Using the domain that is verified on sendgrid (em2922.pinkcreators.com) solves this error.
Not a big deal, just a bit strange.

EDIT
I am still only able to trigger the queue manually, even though I can verify the CRON job is running
result of tail -f /var/log/syslog

Sep 30 11:02:01 email2 CRON[110654]: (root) CMD (php /var/www/html/bin/console mautic:campaigns:trigger^M)
Sep 30 11:02:01 email2 CRON[110655]: (root) CMD (php /var/www/html/bin/console mautic:segments:update^M)
Sep 30 11:02:01 email2 CRON[110656]: (root) CMD (php /var/www/html/bin/console mautic:emails:send^M)
Sep 30 11:02:01 email2 CRON[110657]: (root) CMD (php /var/www/html/bin/console mautic:campaigns:update^M)

But the emails are not sent, just after running
php /var/www/html/bin/console mautic:emails:send manually they are sent out. There are no errors when running the command.
Please help troubleshooting this… Thank you

Finally fixed it… Spent half of the day bashing my head to the table for this…
It was my mistake using nano as crontab editor, because it has added the ^M symbol to the end of lines.

I have installed postfix, and all CRON job errors appeared in /var/spool/mail/root.

1 Like