Feuerwehr-eppingen/app/Console/Kernel.php

79 lines
1.9 KiB
PHP
Executable File

<?php
namespace App\Console;
use Carbon\Carbon;
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\PublishSocialMedia',
'App\Console\Commands\PublishStadtanzeiger',
'App\Console\Commands\PublishNotify',
'App\Console\Commands\QueueCheckup',
'App\Console\Commands\DebugTest',
'App\Console\Commands\ImportData',
\Laravelista\LumenVendorPublish\VendorPublishCommand::class,
//
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$logfile = storage_path('logs/cronlog');
// stellt sicher, dass der Scheduler Zyklisch aufgerufen wird
$schedule->call(function(){
echo "-------------------------------------------------------------------------------\n";
echo "Start ".Carbon::now()->format('d.m.Y H:i:s')."\n";
})
->everyFifteenMinutes()
->appendOutputTo($logfile);
// $schedule->command('publish:notify --postId=1139 --platform=facebook')
// ->everyMinute();
// Überprüfe, ob der Warteschlangenprozess noch läuft
$schedule->command('queue:checkup')
->everyFifteenMinutes()
->appendOutputTo($logfile);
// Veröffentlichung auf Facebook und Twitter
// Täglich um 11:30 Uhr
$schedule->command('publish:social-media')
->dailyAt('11:30')
->appendOutputTo($logfile);
// Veröffentlichung im Stadtanzeiger
// Montags zwischen 00:00 und 00:15 Uhr
$schedule->command('publish:stadtanzeiger')
->mondays()
->at('00:00')
->appendOutputTo($logfile);
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}