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.

    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!