Mautic Community Forums

Problems with scheduled segment emails

Your software
My Mautic version is: 2.15.2
My PHP version is: 7.1.25

Your problem
My problem is: When we schedule a segment email to send at a specific time using the “Publish at (date/time)” the emails remain at pending status. I have the following cron task defined that should be sending the emails.

3,13,23,33,43,53 * * * * su dameon -s /bin/sh -c “/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/app/console mautic:broadcasts:send --channel=email” #send-broadcasts

Using the following to view the system log I can see that the cron task is executing:

sudo cat /var/log/syslog | grep CRON
shows

Jan 14 16:03:01 ip-10-0-1-164 CRON[29820]: (root) CMD (su dameon -s /bin/sh -c “/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/app/console mautic:broadcasts:send --channel=email” #send-broadcasts)

If I attempt to pip the results of the task to a file using the following the log file is not updated:

su dameon -s /bin/sh -c “/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/app/console mautic:broadcasts:send --channel=email >>/temp/cron.log 2>&1”

If I attempt to execute the task directly using the sudo account it will run correctly, send the scheduled broadcast emails and write to the log file if requested to do so.

This task is setup the same as all of my other cron tasks that are running correctly. They all run as su dameon.

Is there something different about the mautic:broadcasts:send command that would cause it to not run as part of a scheduled cron task but would run when executed manually? Does anyone have advice on how I can troubleshoot this further? Thanks in advance for any insight you are able to provide on this issue.

These errors are showing in the log:
There appears to be no errors in the log that relate to this cron task running.

Steps I have tried to fix the problem:

I have verified that the segment email sends properly when I manually run the mautic:broadcasts:send command. I have verified that the cron task is running as expected by viewing the syslog cron related entries.

The tasks runs correctly if I don’t include su dameon to run the task. What permissions does the mautic:broadcasts:send require. These tasks are defined under the root crontab but all others are running as the user su dameon. Is there a reason that mautic:broadcasts:send task will not complete when running under su dameon?