[英]Laravel Scheduler Running multiple time
I'm Using Laravel 5.6 我正在使用Laravel 5.6
In that, I'm running Laravel In Homestead with Scheduler 这样,我就可以使用Scheduler在Homestead中运行Laravel
I Have configured scheduler in Homestead.yaml file like this 我已经在Homestead.yaml文件中配置了调度程序,如下所示
- map: demo.test
to: /home/vagrant/sites/project/public
schedule: true
In Side of App\\Console\\Kernal.php I'm running this code 在App \\ Console \\ Kernal.php的Side中,我正在运行此代码
$schedule->call(function (){
\Log::info('works');
})->at('18:34');
I'm getting Output three-time ??? 我得到输出三倍??? with 4 second delay
延迟4秒
[2019-03-12 18:34:04] local.INFO: works
[2019-03-12 18:34:04] local.INFO: works
[2019-03-12 18:34:04] local.INFO: works
Expected Output one time. 预期输出一次。
[2019-03-12 18:34:00] local.INFO: works
between
is an inclusive function, which means it would run at 17:00, 17:01, and 17:02. between
是包含功能,这意味着它将在17:00、17:01和17:02运行。 If you want it to run once at a specific time, use at()
如果您希望它在特定时间运行一次,请使用
at()
$schedule->call(function (){
\Log::info('works');
})->at('17:01');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.