lundi 4 mai 2020

How to run cron job once a job done without taking any time interval in laravel

I want to run cron job once a job is done without taking any time interval. As I know smallest time interval is 1 minute. I also made custom execution like every 20 second. By I want once a job is done it run automatically without taking any time interval. Also considering Overlapping. Thanks in advance

Here is my code

protected function schedule(Schedule $schedule)
    {
        $schedule->command('second:execute')
                  ->everyMinute();
                 //->withoutOverlapping();
    }  

In commands

public function handle()
    {
    while (true) {
        \Log::useDailyFiles( storage_path() . '/logs/scheduler.log' );
        \Log::info( 'Tried to send mail at: ' . date( "h:i:sa" ) . PHP_EOL );

        sleep(5);
    }
}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire