mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-22 07:30:25 +00:00
Create HealthCheck.php
This commit is contained in:
parent
17aa60351a
commit
0bf0263b7d
1 changed files with 43 additions and 0 deletions
43
web/app/Console/Commands/HealthCheck.php
Normal file
43
web/app/Console/Commands/HealthCheck.php
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
class HealthCheck extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'phyre:health-check';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'Command description';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$this->info('Health check...');
|
||||||
|
|
||||||
|
// Check supervisor
|
||||||
|
$this->info('Checking supervisor...');
|
||||||
|
$supervisorStatus = shell_exec('service supervisor status');
|
||||||
|
if (Str::contains($supervisorStatus, 'active (running)')) {
|
||||||
|
$this->info('Supervisor is running');
|
||||||
|
} else {
|
||||||
|
$this->error('Supervisor is not running');
|
||||||
|
$this->info('Starting supervisor...');
|
||||||
|
shell_exec('service supervisor start');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue