From b0f9d83dcab0a06375671b0c118e88aa9888a7a2 Mon Sep 17 00:00:00 2001 From: paoloar77 Date: Fri, 17 May 2024 10:36:21 +0200 Subject: [PATCH] schedule --- app/Console/Kernel.php | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 7b1e5580..6531f1dd 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -4,6 +4,7 @@ namespace App\Console; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; +use Illuminate\Support\Facades\Log; class Kernel extends ConsoleKernel { @@ -25,13 +26,31 @@ class Kernel extends ConsoleKernel protected function schedule(Schedule $schedule) { // $schedule->command('inspire')->hourly(); - $schedule->command('backup:clean')->daily()->at('02:00'); - $schedule->command('backup:run')->daily()->at('07:00'); - $schedule->command('order:gmupdate')->everyTenMinutes(); - $schedule->command('product:gmupdate')->daily()->at('02:00'); - $schedule->command('product:used:gmupdate')->daily()->at('04:30'); - //$schedule->command('product:updateqta')->hourly()->between('8:00', '00:00')->withoutOverlapping(); - $schedule->command('product:updateqta')->everyFiveMinutes()->between('8:00', '00:00')->withoutOverlapping(); + $schedule->command('backup:clean')->daily()->at('02:00')->before(function () { + Log::info('Running backup:clean command'); + }); + $schedule->command('backup:run')->daily()->at('07:00')->before(function () { + Log::info('Running backup:run command'); + }); + $schedule->command('order:gmupdate')->everyTenMinutes()->before(function () { + Log::info('Running order:gmupdate command'); + }); + $schedule->command('product:gmupdate')->daily()->at('02:00')->before(function () { + Log::info('Running product:gmupdate command'); + }); + $schedule->command('product:used:gmupdate')->daily()->at('04:30')->before(function () { + Log::info('Running product:used:gmupdate command'); + }); + $schedule->command('product:updateqta')->everyFiveMinutes()->between('8:00', '00:00')->withoutOverlapping()->before(function () { + Log::info('Running product:updateqta command'); + }); + $schedule->command('product:testpao') + ->everyMinute() + ->withoutOverlapping() + ->sendOutputTo(storage_path('logs/scheduled-command.log')) + ->before(function () { + Log::info('Running product:testpao command'); + }); } /** @@ -41,7 +60,7 @@ class Kernel extends ConsoleKernel */ protected function commands() { - $this->load(__DIR__.'/Commands'); + $this->load(__DIR__ . '/Commands'); require base_path('routes/console.php'); }