dongme8388 2018-06-27 00:31
浏览 78

Laravel cron入口不能反复运行

I have created a command in laravel to update my entity status every minute. In my Kernel.php, I have this:

/**
     * 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('solicitation:update')
                  ->everyMinute();
    }

When I run solicitation:update or php artisan schedule:run, the command is executed perfectly. Then, I run the command * * * * * php /home/nigellima/Dropbox/Laravel/plataformaTS/artisan schedule:run >> /dev/null 2>&1 to have the task be run every minute, but nothing happens. I have checked my cli package, moved the project to /var/www/ on a remote server but the command is never executed. What am I missing?

I'm using Laravel 5.6 on Ubuntu.

Thanks in advance!

  • 写回答

1条回答 默认 最新

  • doujun7161 2018-06-27 00:38
    关注

    You need to provide the full path to executables in cron. To find the location of PHP, execute which php by the command line. Then update your cron entry accordingly, for example if the path is /usr/bin/php:

    * * * * * /usr/bin/php /home/nigellima/Dropbox/Laravel/plataformaTS/artisan schedule:run >> /dev/null 2>&1
    

    If it still doesn't work, you will have to check your log files to get the actual error. See: https://askubuntu.com/questions/56683/where-is-the-cron-crontab-log.

    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么