Closed Triple-Z closed 7 years ago
The Terminal said "No scheduled commands are ready to run." every time when I executed "php artisan schedule:run".
Here is my /app/Console/Kernel.php
<?php namespace App\Console; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; use App\CardRecord; use Carbon\Carbon; use App\TimeNode; class Kernel extends ConsoleKernel { /** * The Artisan commands provided by your application. * * @var array */ protected $commands = [ \App\Console\Commands\SyncCardRecord::class, \App\Console\Commands\SyncCarRecord::class, \App\Console\Commands\AbsenceSimCheck::class, \App\Console\Commands\UpdateDailyCheckStatus::class, ]; /** * Define the application's command schedule. * * @param \Illuminate\Console\Scheduling\Schedule $schedule * @return void */ protected function schedule(Schedule $schedule) { // Sync card records to records hourly $schedule->command('sync:card') ->hourly() ->timezone('Asia/Shanghai') ->withoutOverlapping() ->evenInMaintenanceMode(); // Sync car records to records hourly $schedule->command('sync:car') ->timezone('Asia/Shanghai') ->hourly() ->withoutOverlapping() ->evenInMaintenanceMode(); // Simulate check for absence-valid employees // At am_start & pm_away $amStart = TimeNode::where('name', '=', 'am_start')->first(); $pmAway = TimeNode::where('name', '=', 'pm_away')->first(); // Create "Hour:minute" strings $am_start_hm = $amStart->hour . ':' . $amStart->minute; $pm_away_hm = $pmAway->hour . ':' . $pmAway->minute; $schedule->command('absence:check') ->timezone('Asia/Shanghai') ->dailyAt($am_start_hm) ->dailyAt($pm_away_hm) ->withoutOverlapping(); // Update daily check status daily at pm_end $pmEnd = TimeNode::where('name', '=', 'pm_end')->first(); $pm_end_hm = $pmEnd->hour . ':' . $pmEnd->minute; $schedule->command('daily:status') ->timezone('Asia/Shanghai') ->dailyAt($pm_end_hm) ->withoutOverlapping(); } /** * Register the Closure based commands for the application. * * @return void */ protected function commands() { require base_path('routes/console.php'); } }
My laravel version is 5.4.
5.4
Addition: Some schedule tasks can be run after I change the function "hourly()" to "everyMinute()".
Is the problem of I cannot write schedule code like this?
Any help will be appreciated!
I have found that if the time don't get there it will be "No scheduled commands are ready to run."...
It's my fault, thank you.
The Terminal said "No scheduled commands are ready to run." every time when I executed "php artisan schedule:run".
Here is my /app/Console/Kernel.php
My laravel version is
5.4
.Addition: Some schedule tasks can be run after I change the function "hourly()" to "everyMinute()".
Is the problem of I cannot write schedule code like this?
Any help will be appreciated!