fix: export Mautic DB vars to cron jobs (backport to mautic7) - #16
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
(cherry picked from commit e71d349) Signed-off-by: henmohr <henriquemohr@redes.ufsm.br>
The line is written verbatim into /tmp/cron.env and evaluated later by the cron job, so the variables must not be expanded at generation time. ShellCheck flags the single-quoted string as SC2016. Suppress it explicitly, as already done for the mautic install check below. Signed-off-by: henmohr <henriquemohr@redes.ufsm.br>
henmohr
force-pushed
the
backport/cron-env-mautic7
branch
from
September 10, 2026 19:03
8dccf93 to
e51dee8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
mautic_croncontainer schedules Mautic's console commands, but the cron daemon does not inherit the container environment.entrypoint_mautic_cron.shonly exported thePHP_INI_VALUE_*variables to/tmp/cron.env(used asBASH_ENV), soconfig/local.phpcould not resolve the database connection throughgetenv('MAUTIC_DB_*').As a result every scheduled command failed with:
because
db_hostwas empty and PDO fell back to the local unix socket. Segments were never rebuilt and campaigns were never triggered.Fix
Backport of e71d349 (main) to the
mautic7release branch: exportMAUTIC_DB_*/MAUTIC_SITE_URLto/tmp/cron.envand defineMAUTIC_DB_DATABASEfromMAUTIC_DB_NAMEwhen it is not set.Validation
The same change was applied to a Mautic 7.2 deployment (
ghcr.io/librecodecoop/mautic:7.2-apache, entrypoint bind-mounted). Before the change every run failed; afterwards:mautic:segments:update- OKmautic:campaigns:rebuild- OKmautic:campaigns:trigger- OKwith zero
SQLSTATEerrors in the container logs.