定时任务问题.
在 app\Console\Kernerl.php 中定义了要执行的任务
protected function schedule(Schedule $schedule)
{
$schedule->call(function () {
DB::table('test')->insert(['name'=>'test']);
})->everyMinute();
}
crontab -e 中也根据文档中说的设置了
* * * * * php /www/artisan schedule:run >> /dev/null 2>&1
以上设置完并没有执行。
然后我单独在命令行中执行:php /www/artisan schedule:run >> /dev/null 2>&1 测试是有效的,
crontab -e 我也测试过能有效定时执行任务的, 不明白为什么 php /www/artisan schedule:run >> /dev/null 2>&1 这个写在 crontab -e 里就不能正常执行了。
求解〜〜
推荐文章: