问题:使用laravel5.7,编写计划任务,测试环境所有的已提供的按时段执行的都可以运行,但是到了生产环境monthlyOn,无法被调用,请问有没有遇到类似问题的同学?
上代码:
// 每个月凌晨跑一次
$schedule->command(test::class)
->monthlyOn(1, '00:20')
->withoutOverlapping(60)
->appendOutputTo(storage_path('/logs/command/command.log'))
->before(function () {
\Log::channel('command')->debug(test::class . ' start');
})
->after(function () {
\Log::channel('command')->debug(test::class . ' end');
})
->timezone('Asia/Shanghai');
猜测:测试环境可以执行,但是生产环境无法执行,可能是用户权限的问题,但是其他的计划任务可以执行,就不是很明白了。
在生产环境切换到计划任务的执行用户后,手动运行此命令看下结果