Purpose of $commands in Kernel.php (Task Scheduling)
I'm bit confused about the exact purpose of the $commands array in the Kernel.php - used for task scheduling.
I simply did
protected function schedule(Schedule $schedule)
{
$schedule->command('inspire:me')->everyMinute();
}
and the task was executed - without adding anything to the $commands array. Am I missing anything?
Also - I found it strange that nothing was put out on the console when the task was running. Typically, it outputs messages indicating the state of the job.
It was used in previous releases (I think until 5.5 maybe) - then the framework added the ability to automagically find the commands. It's still there partly for backwards compatibility and also handy if you want to put your commands in a different directory.
As for output - it'll only print something to the console if the command has something like $this->info('Starting...') inside it.
In general, we don't want output of cron jobs to go to the console - most include a > /dev/null or similar in the crontab to route output to nowhere. Or a log file.
Usually, we would want our cron jobs to log what they are doing rather than output it to the console.
Are you sure your crontab command is not sending the output to nowhere?
The $this->info() in Commands is usually to provide output when the command is run through Artisan.
The end part from >> is sending all output and errors to /dev/null so won't show in your terminal. Try removing everything after run. Do you now see any output? You could change /dev/null to a regular file e.g. /tmp/cron.log. do you see the output in the logs?