Based on the documentation daily runs at midnight. So that's why you think that it does not work, when it didn't actually reached to the right time yet. Try using dailyAt instead and specify the time when to execute.
Aug 11, 2019
7
Level 5
php artisan schedule:run No scheduled commands are ready to run.
Hi everybody,
that's a strange situation:
I edited my app/Console/Kernel.php like this:
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands
= [//
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
*
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('hello:world')->runInBackground()->daily();
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}
hello:world is defined app/Console/Commands/HelloWorld.php:
<?php
namespace App\Console\Commands;
use Carbon\Carbon;
use Illuminate\Support\Facades\Cache;
use Illuminate\Console\Command;
use App\Hello;
class HelloWorld extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'hello:world';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Say hello to the world';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$model = new Hello();
$data = $model->doStuff();
if (!$data) {
$this->warn('Did not work out');
return false;
}
$this->info('Hello worldd');
return true;
}
}
I did this before running:
php artisan cache:clear && php artisan clear-compiled && composer --dump-autoload, but if I do
php artisan schedule:run I get
No scheduled commands are ready to run.
What did I miss?
Edit: everyMinute() instead of daily() works... That's strange... What can I do to make daily() work?
Level 122
They are only run when the time exactly matches the cron pattern. There is no concept of scheduler tasks being outstanding.
1 like
Please or to participate in this conversation.