Laravel “No scheduled commands are ready to run.”

后端 未结 13 1211
囚心锁ツ
囚心锁ツ 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:41

    When you run

    php artisan schedule:run
    

    in the server, where your project is stored, you could see all of your commands running with output, looking like this:

    "Running scheduled command: '/usr/local/bin/php' 'artisan' cache:update > '/dev/null' 2>&1 &"
    

    but only if the current time is the exact one, for which the command is scheduled. Otherwise you are going to see this output:

    "No scheduled commands are ready to run."
    

    For example, if you schedule the command for every five minutes and run the command in 09:07 o'clock you will see that there are no scheduled commands, but if you run it in 09:10 you will see your command running.

    In this way you can just schedule your command to run every 5 min just for debugging purposes:

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

    then observe if there is any error while running and eventually fix it. By me the problem was that I haven't installed GuzzleHttp (shame), so the fix was just running this in the terminal:

    composer require guzzlehttp/guzzle
    

提交回复
热议问题