2015-12-06 18:58:49 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Console;
|
|
|
|
|
|
|
|
use Illuminate\Console\Scheduling\Schedule;
|
|
|
|
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
|
|
|
|
|
|
|
class Kernel extends ConsoleKernel
|
|
|
|
{
|
|
|
|
/**
|
2017-12-17 19:07:38 +00:00
|
|
|
* Register the commands for the application.
|
2015-12-06 18:58:49 +00:00
|
|
|
*/
|
2017-12-17 19:07:38 +00:00
|
|
|
protected function commands()
|
|
|
|
{
|
|
|
|
$this->load(__DIR__ . '/Commands');
|
|
|
|
}
|
2015-12-06 18:58:49 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Define the application's command schedule.
|
|
|
|
*/
|
|
|
|
protected function schedule(Schedule $schedule)
|
|
|
|
{
|
2020-08-21 03:48:08 +00:00
|
|
|
// Execute scheduled commands for servers every minute, as if there was a normal cron running.
|
2017-09-24 17:31:31 +00:00
|
|
|
$schedule->command('p:schedule:process')->everyMinute()->withoutOverlapping();
|
2020-08-21 03:48:08 +00:00
|
|
|
|
2020-12-16 21:15:07 +00:00
|
|
|
// Every 30 minutes, run the backup pruning command so that any abandoned backups can be deleted.
|
2020-12-19 18:50:35 +00:00
|
|
|
$pruneAge = config('backups.prune_age', 360); // Defaults to 6 hours (time is in minuteS)
|
2020-12-16 21:15:07 +00:00
|
|
|
if ($pruneAge > 0) {
|
|
|
|
$schedule->command('p:maintenance:prune-backups', [
|
|
|
|
'--since-minutes' => $pruneAge,
|
|
|
|
])->everyThirtyMinutes();
|
|
|
|
}
|
2020-08-21 03:48:08 +00:00
|
|
|
|
|
|
|
// Every day cleanup any internal backups of service files.
|
2017-09-20 03:10:14 +00:00
|
|
|
$schedule->command('p:maintenance:clean-service-backups')->daily();
|
2015-12-06 18:58:49 +00:00
|
|
|
}
|
|
|
|
}
|