laravel - laravel cron 没有触发,但其他 cron 正在触发
问题描述
我有一个 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
另一方面,如果它们在Commands
目录中,则不必在属性中列出所有命令。
推荐阅读
- python - 输入后如何内联打印
- python - wxpython AttributeError:“ListCtrl”对象没有属性“EnableCheckBoxes”
- webpack - 当我将项目从一个目录复制到另一个目录时,Webpack 构建什么也没产生
- flutter - SDK集成后应用频繁崩溃
- node.js - 尝试安装 Azure Bot 框架工具并出现错误
- office-ui-fabric - 如何实现 Fluent UI DetailsList 拖放行可视化指示器
- python - Django - 使用 CDN 在模板中加载 JSON 文件并访问它的值
- ios - 如何将动画连接到视图?动画忽略插座和 UIView 大小
- go - 为什么你需要在大猩猩会话中保存一些东西?
- mysql - 如果条件为“on”的内部联接查询