Php Cron作业未运行Laravel 5.3
因此,我已经设置了内核文件,将命令安排在每天凌晨2点运行Php Cron作业未运行Laravel 5.3,php,laravel,laravel-5,cron,laravel-5.3,Php,Laravel,Laravel 5,Cron,Laravel 5.3,因此,我已经设置了内核文件,将命令安排在每天凌晨2点运行 class Kernel extends ConsoleKernel { /** * The Artisan commands provided by your application. * * @var array */ protected $commands = [ Commands\Users\MyCommand::class ]; /** * Define the application's command s
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
Commands\Users\MyCommand::class
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command(Commands\Users\MyCommand::class)
->dailyAt('02:00');
}
}
我还按照文档的建议在命令行中运行了此命令:
* * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1
当我在命令行中运行“php artisan MY COMMAND NAME”时,命令将执行。另外,当我使用schedule:run时,命令也会运行
但是,我希望它在指定的时间自动运行,而这不会发生
/path/to/artisan
应为artisan的实际路径。通常类似于/home/myUser/laravel/artisan
或安装laravel/artisan的任何位置。您必须将此命令添加到cron作业中
* * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1
要编辑cron作业,请首先键入此命令
crontab -e