what happens to schedule in laravel when it is artisan down?

时间:2015-10-06 08:59:28

标签: laravel laravel-5.1

Is schedule still run when app in laravel is in maintenance mode?

So I put app in down:

php artisan down

and schedule in console/kernel.php

protected function schedule(Schedule $schedule)
{

    $schedule->command('tbcpay:closeday')
             ->daily() // midnight
             ->sendOutputTo('storage/logs/TbcpayCloseDay.log');

}

2 个答案:

答案 0 :(得分:2)

如果您想在维护模式下停止计划,可以尝试那样

protected function schedule(Schedule $schedule)
{
   if(!\App::isDownForMaintenance()){
      $schedule->command('tbcpay:closeday')
         ->daily() // midnight
         ->sendOutputTo('storage/logs/TbcpayCloseDay.log');
      }
 }

答案 1 :(得分:1)

事实并非如此,Laravel Docs确认调度程序未在维护模式下运行:

https://laravel.com/docs/5.8/scheduling#maintenance-mode

  

维护模式

     

当Laravel处于维护模式时,Laravel的计划任务将不会运行,因为我们不希望您的任务干扰您可能正在服务器上执行的所有未完成的维护。