Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scheduler cron job is running but artisan schedule:run command did not triggered #3114

Closed
iammh93 opened this issue Dec 21, 2021 · 1 comment

Comments

@iammh93
Copy link

iammh93 commented Dec 21, 2021

Description:

I followed the instruction to update the crontab in workspace
`

          • laradock /usr/bin/php /var/www/marketplace artisan schedule:run >> /dev/null 2>&1
            `

I added \Log::debug("schedule run"); in my Kernel.php to verify that it is working.

Then i rebuild the workspace and found out there is no log, when check the /var/log/cron.log, it showed the command had been executed

Capture

I also tried execute the command manually inside workspace and confirmed it is working if without the crontab.

Expected Behavior:

Crontab should execute artisan schedule:run and trigger the logging "schedule run"

Stacktrace & Additional info:

PHP_VERSION=7.3
Docker version = 4.2.0
@iammh93
Copy link
Author

iammh93 commented Dec 22, 2021

After change the cronjob into * * * * * laradock cd /var/www/marketplace && php artisan schedule:run >> /dev/null 2>&1 and it worked, not sure why the documentation way is not working.
Furthermore, i hit another issue which is "crontab missing newline before eof". This is caused by my host OS which is window 10. The recommended way to solve this is using linux to create the cronjob file. But for me to solve this, i removed the code inside crontab/laradock and add one more line to append the cron job after copy the cron tab files.

`
COPY ./crontab /etc/cron.d
RUN chmod -R 644 /etc/cron.d
RUN echo "* * * * * laradock cd /var/www/marketplace && php artisan schedule:run >> /dev/null 2>&1" >> /etc/cron.d/laradock

`

@iammh93 iammh93 closed this as completed Dec 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant