Skip to content

Instantly share code, notes, and snippets.

@alexgarrettsmith
Last active December 8, 2017 20:32
Show Gist options
  • Save alexgarrettsmith/0c2d91a26558e3e08af31d45ddf1a9e2 to your computer and use it in GitHub Desktop.
Save alexgarrettsmith/0c2d91a26558e3e08af31d45ddf1a9e2 to your computer and use it in GitHub Desktop.
<?php
namespace Codecourse\App\Console\Commands;
use Illuminate\Console\Command;
class SchedulerDaemon extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'schedule:daemon {--timeout=60}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Call the scheduler every minute.';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
while (true) {
$this->call('schedule:run');
sleep($this->option('timeout'));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment