Reputation: 8035
I've setup a command like this:
protected function schedule(Schedule $schedule)
{
$schedule->command('feeds:fetch')->everyFiveMinutes();
}
I've setup a cron job to run php artisan schedule:run
When I run that line on dev's terminal it runs the task OK. On Prod it returns "No scheduled commands are ready to run."
Any way to troubleshoot this?
Upvotes: 6
Views: 9436
Reputation: 87
I have found a solution for this problem. Just add the timestamp in the $schedule.
You can change the command name, time and timezone according to your requirements.
$schedule->command('tenam:before')
->dailyAt('22:28')->timezone('Asia/Kolkata');
Upvotes: 0
Reputation: 8035
The fine folks at Larachat (https://larachat.slack.com/) helped me out debug this issue.
The problem was with my crontab. I was setting the crontab to execute the artisan scheduler as follows:
*/1 * * * * php /path/to/artisan schedule:run
(meaning execute every 1st minute of every hour every day.)
When it should be:
* * * * * php /path/to/artisan schedule:run
(meaning execute every minute of every hour every day.)
So, when I manually ran cron on a non-1st minute of every hour, it didn't run at all.
Upvotes: 5