所以我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:cinema
等,
然而没有任何反应。命令应该调用应该进入队列的作业,但队列是空的!
当我手动触发命令时,它工作正常!
当我按照这样的方式安排工作时:
205986 Every Minute * * * * * forge php /home/forge/app.com/current/artisan scrape:cinema
它也可以。
发生了什么......