【问题标题】:run cron job in octobercms cpanel在 octobercms cpanel 中运行 cron 作业
【发布时间】:2021-07-28 11:33:03
【问题描述】:

我必须更新我的汇率,我的 Plugin.php 中有这个:

    public function registerSchedule($schedule) {
        $schedule->call(function () {
            $url = "https://cbu.uz/ru/services/open_data/rates/json/";
            $json = json_decode(file_get_contents($url), true);
            file_put_contents("currency.json", json_encode($json[0]['G4']));            
        })->everyMinute();
    }

我在 cPanel 中运行我的 cron 作业

/usr/local/bin/ea-php72 /var/www/u1041398/public_html/agroparts.uz/artisan schedule:run >> /dev/null 2>&1 

路径是正确的,我检查了 PHP 版本,它也正确。我在 plugin.php 中的 cron 代码也是正确的,但它没有更新货币汇率。上面的这个命令是否正确运行 cron 作业?我在没有 cron 的情况下检查了我的代码,它运行成功。

【问题讨论】:

    标签: laravel octobercms octobercms-backend


    【解决方案1】:

    Cron 作业没有显示错误。因此,我创建了控制台命令来更新货币汇率并运行它并显示

     file_get_contents(): https:// wrapper is disabled in the server configurati  
      on by allow_url_fopen=0                                                      
                                
    

    所以我使用 curl 来获取货币汇率并工作

    【讨论】:

      猜你喜欢
      • 2014-07-22
      • 2017-02-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-30
      • 2013-11-18
      • 2021-01-18
      • 1970-01-01
      相关资源
      最近更新 更多