php - Laravel - Cron 作业无法在实时服务器上运行
问题描述
我正在使用 laravel 7,我使用 schedule:run 命令创建了一个在 localhost 上正常工作但不能在 cpanel 上
工作的
命令,这是我试图在我的 cpanel 中配置的玉米作业命令。(我已共享 cpanel 托管)
/usr/bin/php -d register_argc_argv=on /home/flakhost/sashatraders.com/@core/artisan schedule:run >> /dev/null 2>&1
我的 kernel.php 文件代码是
<?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 = [
Commands\BoostRank::class,
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')->hourly();
$schedule->command('boost:rank')
->everyMinute();
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}
我相信所有代码都很好,但是我的 cpanel cron 作业命令存在一些问题。 亲切的阅读:
解决方案
我更新了我的 cron 工作并且它有效
/usr/bin/php -q /home/flakhost/sashatraders.com/@core/artisan schedule:run
推荐阅读
- tensorflow - 如何将获得的模型根据 SSDMetaArch 对象保存到 .pbtxt 或 .ckpt
- android - stopService 是否会从服务中杀死子线程
- uri - 为什么规范/词汇的 URI 包含日期信息?
- wordpress - 使用 Timber 将变量放入 WordPress 短代码中
- javascript - 如何使用 AJAX 重新加载 Laravel @includes?
- regex - 如何使正则表达式不贪婪地提取特定元素
- python - 绘制数小时内每列数据帧的最大值
- c++ - 如何访问存储在父类中的子类成员?
- c# - 用于匹配和替换子字符串的正则表达式
- android - 对 google play 商店保持星级和评论