Why runninh schedule command I got error “No scheduled commands are ready to run”?

  Kiến thức lập trình

On laravel 10 app reading how scheduling works at https://laravel.com/docs/10.x/scheduling

In app/Console/Kernel.php I added 2 commands :

protected function schedule(Schedule $schedule): void
{
    $schedule->command('app:rss-import-by-url-test-command 1')->hourly('00:00');
    $schedule->command(SpatieHealthCommandsRunHealthChecksCommand::class)->daily();
}

But I got errors with running:

 $ php artisan schedule:run
INFO  No scheduled commands are ready to run.

First is class in my custom command :

<?php

namespace AppConsoleCommands;

use IlluminateConsoleCommand;

class RssImportByUrlTestCommand extends Command
{
    protected $signature = 'app:rss-import-by-url-test-command  {defaultCompanyId?} {createPublished?}';
    ...

The second is from spatie/laravel-health package(I found this class in my app).

Also I find these command in next output :

$ php artisan list
Laravel Framework 10.48.7

Usage:
  command [options] [arguments]

Options:
  -h, --help            Display help for the given command. When no command is given display help for the list command
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
      --env[=ENV]       The environment the command should run under
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  about                                 Display basic information about your application
  clear-compiled                        Remove the compiled class file
  completion                            Dump the shell completion script
  db                                    Start a new database CLI session
  docs                                  Access the Laravel documentation
  down                                  Put the application into maintenance / demo mode
  env                                   Display the current framework environment
  help                                  Display help for a command
  inspire                               Display an inspiring quote
  list                                  List commands
  migrate                               Run the database migrations
  optimize                              Cache the framework bootstrap files
  serve                                 Serve the application on the PHP development server
  test                                  Run the application tests
  tinker                                Interact with your application
  up                                    Bring the application out of maintenance mode
 app
  app:rss-import-by-url-test-command    Command to import news from rss link (news_categories.rss_link field) into news table
  ...
 health
  health:check                          Run all health checks
  health:list                           List all health checks
  health:queue-check-heartbeat
  health:schedule-check-heartbeat
 ide-helper
  ide-helper:eloquent                   Add Eloquent helper to EloquentModel
  ide-helper:generate                   Generate a new IDE Helper file.
  ide-helper:meta                       Generate metadata for PhpStorm
  ide-helper:models                     Generate autocompletion for models
 key
  key:generate                          Set the application key
  ...

Why I got these errors with existing in my app commands ?
Also how laravel finds when need to run command? Does it save time of last command run in some internal table ?

"laravel/framework": "^10.48.4",
"spatie/laravel-health": "^1.27",

Thanks in advance!

LEAVE A COMMENT