From 0bf0263b7d66b9ea896d86c7ff2e5d44c36ad5c8 Mon Sep 17 00:00:00 2001 From: Bozhidar Date: Thu, 16 May 2024 14:57:10 +0300 Subject: [PATCH] Create HealthCheck.php --- web/app/Console/Commands/HealthCheck.php | 43 ++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 web/app/Console/Commands/HealthCheck.php diff --git a/web/app/Console/Commands/HealthCheck.php b/web/app/Console/Commands/HealthCheck.php new file mode 100644 index 0000000..5e9ffd0 --- /dev/null +++ b/web/app/Console/Commands/HealthCheck.php @@ -0,0 +1,43 @@ +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'); + } + + } +}