Laravel “No scheduled commands are ready to run.”

后端 未结 13 1212
囚心锁ツ
囚心锁ツ 2020-12-09 08:39

I\'ve set up the following Laravel commands:

protected function schedule(Schedule $schedule) {
        $schedule->command(\'command:daily-reset\')->dai         


        
13条回答
  •  爱一瞬间的悲伤
    2020-12-09 08:46

    The Laravel scheduled commands are based in the timezone that you have configured in your app/config/app.php file (laravel 5.1):

    /*
    |--------------------------------------------------------------------------
    | Application Timezone
    |--------------------------------------------------------------------------
    |
    | Here you may specify the default timezone for your application, which
    | will be used by the PHP date and date-time functions. We have gone
    | ahead and set this to a sensible default for you out of the box.
    |
    */
    
    'timezone' => 'America/Bogota',
    

    So if you create a command and register it to run as a scheduled task with:

    $schedule->command('command:daily-reset')->daily();
    

    it will run every day at 00:00 OF THE TIMEZONE SPECIFIED (in this case America/Bogota)

    The same thing applies if you specify a time to run the task:

    $schedule->command('command:daily-reset')->daily()->at('02:30');
    

    This will run at 02:30 am in America/Bogota local time.

提交回复
热议问题