Skip to content
Advertisement

Laravel + Crontab not working

I am trying to set up scheduler in Laravel.

Here is my crontab which I debugged and works fine – atleast with my cron job

JavaScript

I don’t know if this one works:

JavaScript

Here is my schedule function in Kernel:

JavaScript

When I am in my project and try php artisan inspire it actually works, so I expected it to fire every minute, but it won’t do anything. Nothing happens.

Any ideas?

Advertisement

Answer

This part just puts the output into oblivion so you’ll never see it:

JavaScript

Why not try:

JavaScript

And check to see if the cron is run in /my_path/example.txt

The default inspire command essentially just echo’s a quote so the only way to see it in a cron is to output it to a file on the server.

You can do this using something similar to this:

JavaScript

Further details: https://laravel.com/docs/5.4/scheduling#task-output

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement