为什么我不打开我的crontab?Laravel 5任务计划



我刚刚开始使用Artisan命令,该命令每分钟使用Laravel任务调度来输出" Hello"。

我的命令'php工匠deeteTeinActiveEvents:deleteevents'输出终端中应该是什么:"你好"。

我的命令:

class deleteInActiveEvents extends Command
{
/**
 * The name and signature of the console command.
 *
 * @var string
 */
protected $signature = 'DeleteInActiveEvents:deleteevents';
/**
 * The console command description.
 *
 * @var string
 */
protected $description = 'Command description';
/**
 * Create a new command instance.
 *
 * @return void
 */
public function __construct()
{
    parent::__construct();
}
/**
 * Execute the console command.
 *
 * @return mixed
 */
public function handle()
{
  echo "hello";
}

我的kernel.php

class Kernel extends ConsoleKernel
{
/**
 * The Artisan commands provided by your application.
 *
 * @var array
 */
protected $commands = [
   einkdisplayConsoleCommandsDeleteInActiveEvents::class
];
/**
 * Define the application's command schedule.
 *
 * @param  IlluminateConsoleSchedulingSchedule  $schedule
 * @return void
 */
protected function schedule(Schedule $schedule)
{
  $schedule->command('DeleteInActiveEvents:deleteevents')->everyMinute();
}
/**
 * Register the Closure based commands for the application.
 *
 * @return void
 */
protected function commands()
{
    require base_path('routes/console.php');
}

因此,此时一切仍在起作用。但是我想每分钟做这个命令。当我运行PHP Artisan计划时:运行它没有运行命令。Laravel文档说我需要添加:

          • php/to Your-project/Artisan时间表:运行>>/dev/null 2>& 1

到我的crontab。但是,当我在终端中使用crontab -e时,我没有得到我的crontab,也无法添加此代码。可能是一个非常菜鸟的问题,但我无法弄清楚。在正确的方向上有一些帮助将不胜感激!

我最好的猜测是您无权保存crontab。您是否尝试使用sudo crontab -e

最新更新