title: laravel cannot run scheduled command, while queue:listen run schedule() periodically
body: <p><strong><em>Note: My question has nothing to do with <a href="https://stackoverflow.com/q/47513845/6521116">Command schedule in Laravel</a> which schedule not work. But in my question the scheduling works, but it cannot call the artisan command.</em></strong></p>
  
  <p>I use laravel scheduling artisan command. I run the command directly from the console like this <code>sudo -u www-data /var/www/market/artisan command:printer-serving 281H28</code>. </p>
  
  <p>I know it works because, I've <code>Log::info('Working')</code> at the entry of the <code>handle()</code> function of the command.</p>
  
  <p>While when I use laravel's scheduling. And the cron works well, for below <code>Log::info('command:printer-serving 281H28');</code> output the content to the console continuously. </p>
  
  <p><strong>But the artisan command not executed, it output nothing to the console, and not write something to the DB</strong></p>
  
  <p>In the Kernel.php</p>
  
  <pre><code>&lt;?php namespace App\Console;
  
  use Illuminate\Console\Scheduling\Schedule;
  use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
  use Log;
  
  class Kernel extends ConsoleKernel {
  
      /**
       * The Artisan commands provided by your application.
       *
       * @var array
       */
      protected $commands = [
          'App\Console\Commands\Inspire',
          'App\Console\Commands\CommandPrinterServing',
      ];
  
      /**
       * Define the application's command schedule.
       *
       * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
       * @return void
       */
      protected function schedule(Schedule $schedule)
      {
          $schedule-&gt;command('inspire')-&gt;hourly();
          Log::info('command:printer-serving 281H28');
          $schedule-&gt;command('command:printer-serving --force 281H28')-&gt;everyMinute();
          //$schedule-&gt;command('printer-serving')-&gt;everyMinute();
          //$schedule-&gt;command(CommandPrinterServing::class, ['281H28'])-&gt;everyMinute();
      }
  
  }
  </code></pre>
  
  <p>Command name, <code>protected $signature = 'command:printer-serving {pid}';</code></p>
  
  <p><strong>Note</strong>
  No matter what string even not a command I put in <code>$schedule-&gt;command()</code> function, nothing will changes and not a error reported from the cron log or laravel log.</p>
  
  <p>I want to know how to debug the  <code>$schedule-&gt;command()</code> function.</p>
  
  <hr>
  
  <p>Cron file <code>vi /etc/cron.minutely/printer-task-minute</code></p>
  
  <pre><code>#!/bin/sh
  cd /var/www/market
  sudo -u www-data ./artisan command:regen-htaccess
  #sudo -u www-data ./artisan schedule:run &gt;&gt; /dev/null 2&gt;&amp;1
  sudo -u www-data ./artisan schedule:run
  </code></pre>
  
  <p>The weired thing is log output four thmes every 3 seconds.   </p>
  
  <pre><code>&gt; [2017-11-29 16:52:14] worker_env.INFO: command:printer-serving 281H28 
  &gt; [2017-11-29 16:52:14] worker_env.INFO: command:printer-serving 281H28 
  &gt; [2017-11-29 16:52:14] worker_env.INFO: command:printer-serving 281H28 
  &gt; [2017-11-29 16:52:14] worker_env.INFO: command:printer-serving 281H28 
  &gt; [2017-11-29 16:52:17] worker_env.INFO: command:printer-serving 281H28 
  &gt; [2017-11-29 16:52:17] worker_env.INFO: command:printer-serving 281H28 
  &gt; [2017-11-29 16:52:17] worker_env.INFO: command:printer-serving 281H28 
  &gt; [2017-11-29 16:52:17] worker_env.INFO: command:printer-serving 281H28 
  &gt; [2017-11-29 16:52:21] worker_env.INFO: command:printer-serving 281H28 
  &gt; [2017-11-29 16:52:21] worker_env.INFO: command:printer-serving 281H28 
  &gt; [2017-11-29 16:52:21] worker_env.INFO: command:printer-serving 281H28 
  &gt; [2017-11-29 16:52:21] worker_env.INFO: command:printer-serving 281H28 
  &gt; [2017-11-29 16:52:24] worker_env.INFO: command:printer-serving 281H28
  </code></pre>
  
  <p>I'm puzzled about the log frequency, so I stop cron and beanstalkd. But the log output doesn't stop. Even I stop apache2, the log keeping output. Then I check the php process, and find there are four <code>queue:listen --queue=xxxx --env=worker_env --delay=3</code> in the output of command <code>ps aux | grep php</code>. Here I found why the log output in that frequency, but I don't know why <code>queue:listen</code> execute the <code>schedule()</code> function as this question <a href="https://stackoverflow.com/q/36625969/6521116">Understanding Queues and Scheduler on Laravel 5.2</a>.</p>
  
  <hr>
  
  <p>Each time I executed a artisan command <code>sudo -u www-data /var/www/market/artisan xxxxx</code> the <code>schedule()</code> function will be called one time. And if the command is <code>queue:listen</code> like <code>sudo -u www-data /var/www/market/artisan queue:listen xxxxx</code> the <code>schedule()</code> function will be called periodically. But the command in the <code>schedule()</code> will not run, except the <code>Log::info()</code>. Only when run <code>schedule:run</code> command, both the artisan command and <code>Log::info()</code> in <code>schedule()</code> will executed.</p>