Decription
I'm running php /var/www/html/artisan schedule:run
on cron
but it's not working.
I've added the following steps to my Dockerfile
:
FROM php:7.4.1-apache
...
RUN apt-get update && apt-get install -y cron
...
COPY ./.docker/cronjobs /etc/
RUN touch /var/www/html/schedule-run.log
RUN crontab /etc/cronjobs
Then, the cron
is one of the CI steps that has added to .gitlab-ci.yml
.
The ./.docker/cronjobs
file is like:
* * * * * date >> /var/www/html/schedule-run.log
* * * * * php /var/www/html/artisan schedule:run >> /var/www/html/schedule-run.log
Everything is ok with the first line and I can see the output of the date
command at /var/www/html/schedule-run.log
.
Problem
The problem is with the second line of ./.docker/cronjobs
which is telling the cron
that running schedule:run
every minute.
I've run php /var/www/html/artisan schedule:run >> /var/www/html/schedule-run.log
directory to the bash
of the container then I say the output of that at /var/www/html/schedule-run.log
.
In the other words, the command is ok but when the cron
wanted to run it, it's not going to be run.
Environment
Docker-compose: 1.25.4, build 8d51620a
Docker: 19.03.6
Machine: Ubuntu 18.0.4 LTS
Experiance
I've checked out the following questions but the problem doesn't solve.