简体   繁体   中英

Laravel scheduler and docker cron

I have a docker file which has some of the following

ADD ./.docker/config/cron/$BUILD_ENV.cron /etc/cron.d/cron
RUN chmod 0644 /etc/cron.d/cron
RUN touch /var/log/cron.log

and the file ends with

CMD cron && tail -f /var/log/cron.log

My cron file comprises of

* * * * * root /usr/local/bin/php /var/www/pub/artisan schedule:run >> /var/log/cron.log 2>&1

With the extra line of course.

If I create the file with the following the cron runs.

 * * * * * root echo "Hello world" >> /var/log/cron.log 2>&1

However my laravel artisan isn't firing? Any help would be appreciated. The cron is created as root, and executed as root.

From this similar question :

Can you try RUN echo "* * * * * root php /var/www/artisan schedule:run >> /var/log/cron.log 2>&1" >> /etc/crontab in your dockerfile?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM