我迷失在我做错了,我看不到任何人有这个问题,所以它一定是我。调度员w/Laravel复制输出
我刚刚设置了Indatus\Dispatcher\ServiceProvider
并且一切正常。出于测试目的,我只是每5分钟运行一个预定事件来添加日志条目。
出于某种原因,它正在复制日志条目。
下面是输出看起来像:
[2014-10-26 19:00:15] local.INFO: This is a test [] []
[2014-10-26 19:00:15] local.INFO: This is a test [] []
[2014-10-26 19:05:12] local.INFO: This is a test [] []
[2014-10-26 19:05:13] local.INFO: This is a test [] []
[2014-10-26 19:10:09] local.INFO: This is a test [] []
[2014-10-26 19:10:10] local.INFO: This is a test [] []
这里的实际安排fire()
事件:
public function fire()
{
Log::info('This is a test');
}
的schedule()
:
public function schedule(Schedulable $scheduler)
{
return $scheduler->everyMinutes(5);
}
,我已经检查了scheduled:summary
它只显示一次:
+----------------+------------------+-----------+--------+------+--------------+-------+-------------+--------+
| Environment(s) | Name | Args/Opts | Minute | Hour | Day of Month | Month | Day of Week | Run as |
+----------------+------------------+-----------+--------+------+--------------+-------+-------------+--------+
| * | schedule:test | | */5 | * | * | * | * | |
+----------------+------------------+-----------+--------+------+--------------+-------+-------------+--------+
最后我的crontab条目,这是唯一的一次文件中列出:
* * * * * php /vagrant/myapp/artisan scheduled:run 1>> /dev/null 2>&1
我看不到会导致它运行两次任何重复。
任何想法我错了什么?
**编辑:**
按照要求,从测试命令全文:
使用Indatus \调度\计划\ ScheduledCommand; 使用Indatus \ Dispatcher \ Scheduling \ Schedulable; 使用Indatus \ Dispatcher \ Drivers \ Cron \ Scheduler; 使用Symfony \ Component \ Console \ Input \ InputOption; 使用Symfony \ Component \ Console \ Input \ InputArgument;
class NewSchedule extends ScheduledCommand {
/**
* The console command name.
*
* @var string
*/
protected $name = 'schedule:test';
/**
* The console command description.
*
* @var string
*/
protected $description = 'This is a test command';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* When a command should run
*
* @param Scheduler $scheduler
* @return \Indatus\Dispatcher\Scheduling\Schedulable
*/
public function schedule(Schedulable $scheduler)
{
return $scheduler->everyMinutes(5);
}
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
Log::info('This is a test');
}
}
不应该是他们唯一的一个> – 2014-10-27 02:04:43
Crondeamon可能运行两次 – 2014-10-27 02:12:47
如果你运行'PHP工匠时间表:???在命令行test' - 它只有一个或两个enteries添加到日志 – Laurence 2014-10-27 04:06:11