Add separate cron runner that doesn't use proc_open (#1405)
* Add alternative to using the artisan schedule runner * StyleCI fixes * Add additional cron time periods * Style fixes * Typo * Update the web cron to use the new system * Write out JSON for which tasks were run * Rename cron.php to just cron
This commit is contained in:
35
bin/cron
Executable file
35
bin/cron
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
* THIS CRON FILE IS A BACKUP METHOD IF YOUR SERVER DOES NOT HAVE PROC_OPEN ENABLED
|
||||
* YOU SHOULD TRY USING THE DEFAULT INSTRUCTIONS OF USING ARTISAN SCHEDULE:RUN
|
||||
*/
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
use App\Console\Cron;
|
||||
use App\Console\Kernel;
|
||||
|
||||
require __DIR__.'/../vendor/autoload.php';
|
||||
|
||||
/** @var Application $app */
|
||||
$app = require_once __DIR__.'/../bootstrap/app.php';
|
||||
|
||||
/** @var Kernel $kernel */
|
||||
$kernel = $app->make(Kernel::class);
|
||||
|
||||
// Run a null artisan thing just so Laravel internals can be setup properly
|
||||
$status = $kernel->handle(
|
||||
$input = new Symfony\Component\Console\Input\ArrayInput([
|
||||
'command' => 'version',
|
||||
]),
|
||||
new Symfony\Component\Console\Output\NullOutput()
|
||||
);
|
||||
|
||||
/** @var Cron $cron */
|
||||
$cron = app(Cron::class);
|
||||
$run = $cron->run();
|
||||
|
||||
echo json_encode([
|
||||
'count' => count($run),
|
||||
'tasks' => $run,
|
||||
]);
|
||||
Reference in New Issue
Block a user