I am trying to run a Symfony command every minute, but the environment variables are not loaded. I am doing it as follows right now:
* * * * * root php /var/www/html/bin/console app:run-scheduler > /proc/1/fd/1 2>/proc/1/fd/2
The cron file is copied in the Dockerfile:
cp fly/cron /etc/cron.d/send-test-message
The file is properly copied and the command is also correct. The problem is that within bin/console
the environment variables aren’t present.
So I am getting errors like this:
That’s because only in dev
the profiler is loaded, and dev
is the default APP_ENV
for Symfony.
Any ideas how I can get the environment variables within bin/console
?
I am running it in a separate VM:
[processes]
app = ''
worker = 'php bin/console messenger:consume -vvv'
scheduler = 'cron -f'