gpt4 book ai didi

laravel cron 没有触发,但其他 cron 正在触发

转载 作者:行者123 更新时间:2023-12-04 18:44:51 26 4
gpt4 key购买 nike

我有一个 ubuntu 18.04 设置并运行 laravel 5.6,我已经在 crontab -e 中设置了默认调度程序

* * * * * php /var/www/html/laravel/artisan schedule:run >> /var/www/html/crons.txt 2>&1

这没有运行

我的内核代码
<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
'App\Console\Commands\CompletelyReviewInternship',
'App\Console\Commands\MigrateUsers',
'App\Console\Commands\MigrateUsersTwo',
'App\Console\Commands\MigrateUsersThree',
'App\Console\Commands\MigrateUsersFour',
'App\Console\Commands\MigrateUsersFive',
'App\Console\Commands\MigrateUsersSix',
'App\Console\Commands\MigrateUsersSeven',
'App\Console\Commands\MigrateUsersEight',
'App\Console\Commands\MigrateUsersNine',
'App\Console\Commands\MigrateUsersTen'
];

/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('review:internship')->hourly();

$schedule->command('migrate:users')->dailyAt('17:40');

$schedule->command('migrate:userstwo')->dailyAt('17:40');

$schedule->command('migrate:usersthree')->dailyAt('17:40');

$schedule->command('migrate:usersthree')->dailyAt('17:40');

$schedule->command('migrate:usersfour')->dailyAt('17:40');

$schedule->command('migrate:usersfive')->dailyAt('17:40');

$schedule->command('migrate:userssix')->dailyAt('17:40');

$schedule->command('migrate:usersseven')->dailyAt('17:40');

$schedule->command('migrate:userseight')->dailyAt('17:40');

$schedule->command('migrate:usersnine')->dailyAt('17:40');

$schedule->command('migrate:usersten')->dailyAt('17:40');

}

/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');

require base_path('routes/console.php');
}
}

请注意:-我的命令是用 php artisan 触发的
我使用 nginx 作为我的网络服务器

建议对此提出任何建议

最佳答案

我认为这可能有多种原因:

  • 您的应用程序处于维护模式。在这种情况下,除非您使用 ->evenInMaintenanceMode(),否则不会运行任何命令。对于每个命令
  • 您正在使用时间,但您机器上的时间与您预期的不同,因此命令将在稍后运行。确保时间确实有效,或尝试将时间限制更改为 ->everyMinute()只是为了确保在这种情况下没有问题

  • 另一方面,没有必要在 $commands 中列出所有命令属性(property),如果他们在 Commands目录。

    关于laravel cron 没有触发,但其他 cron 正在触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52518333/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com