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 = [
        'App\Console\Commands\IcalConvert',
        'App\Console\Commands\NewsScrape',
        'App\Console\Commands\CinemaScrape',
        'App\Console\Commands\DownloadIcal',
        'App\Console\Commands\EventCreate',
        'App\Console\Commands\EventDelete',
        'App\Console\Commands\EventUpdate',
        'App\Console\Commands\DeleteOldEvents',
        'App\Console\Commands\ClearEvents',
        'App\Console\Commands\EventReCalculate',
        'App\Console\Commands\MondayEmail',
        'App\Console\Commands\UploadToS3'
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        $ping =  config('app.ping');
        /*
        $schedule->command('scrape:news')
                 ->hourly()
                 ->weekdays()
                 ->between('7:00', '18:00')
                 ->sendOutputTo($log)
                 ->thenPing($ping);
        */
        $schedule->command('scrape:cinema')
                 ->dailyAt('04:00')
                 ->sendOutputTo($log)
                 ->thenPing($ping);
        $schedule->command('ical:download')
                 ->hourly()
                 ->sendOutputTo($log)
                 ->thenPing($ping);
        $schedule->command('ical:convert')
                 ->hourly()
                 ->sendOutputTo($log)
                 ->thenPing($ping);
        $schedule->command('events:forcedelete')
                 ->dailyAt('02:00')
                 ->sendOutputTo($log)
                 ->thenPing($ping);
        $schedule->command('events:recalculate')
                ->dailyAt('2:15')
                ->sendOutputTo($log)
                ->thenPing($ping);
        $schedule->command('event:clear')
                 ->everyTenMinutes()
                 ->sendOutputTo($log)
                 ->thenPing($ping);
    }

    /**
     * Register the Closure based commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        require base_path('routes/console.php');
    }
}

并在forge

205984 Every Minute * * * * * forge php /home/forge/app.com/current/artisan schedule:run

发生的情况是日志显示命令正在被触发,即:

scheduling scrape:cinemaETC,

然而什么也没有发生。命令应该调用一个应该进入队列的作业,但是队列是空的!

当我手动触发命令时,它工作正常!

当我在 forge 中安排这样的工作时:

 205986 Every Minute * * * * * forge php /home/forge/app.com/current/artisan scrape:cinema

它也可以正常工作。

到底是怎么回事...

4

0 回答 0