Fixing the issue where environment variables aren’t applied in the Laravel scheduler
Ah, in most cases, people run the cron service in Docker using supervisord. Environment variables aren’t injected properly where this cron service runs. They sa
GGAMI
Ah, in most cases, people run the cron service in Docker using supervisord.
Environment variables aren’t injected properly where this cron service runs.
They say it’s because the user is different, so the environment variables are different. To fix this issue, write it as follows.
[supervisord]
nodaemon=true
[program:cron]
command=/bin/bash -c "printenv > /etc/environment && /usr/sbin/cron -f"
autostart=true
autorestart=true
user=root
redirect_stderr=true
stdout_events_enabled=true
stderr_events_enabled=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0