Answer the question
In order to leave comments, you need to log in
Why does CRON-schedule:run execute a command once?
Can't get command to run every minute
class Kernel extends ConsoleKernel
{
protected $commands = [
'App\Console\Commands\CheckSite',
];
protected function schedule(Schedule $schedule)
{
$schedule->command('check:site')->everyMinute();
}
namespace App\Console\Commands;
use Illuminate\Console\Command;
class CheckSite extends Command
{
protected $signature = 'check:site';
protected $description = 'The console command description.';
public function __construct()
{
parent::__construct();
}
public function handle()
{
// dd('test');
Log:info('чек сайт');
}
}
php artisan schedule:run
Answer the question
In order to leave comments, you need to log in
Tell me where is the mistake?If you would just for a second think about what you write. This command that you write is one-time. In order for it to run every minute, you must run it every minute in the console. But since you won't be able to do this on the production site, you need to run this command via cron. The documentation has everything for this. But what is cron you first need to learn
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question