This commit is contained in:
Bozhidar 2024-05-10 16:29:17 +03:00
parent 1ea5c22b4d
commit 4a181c57c6
2 changed files with 14 additions and 6 deletions

View file

@ -39,7 +39,7 @@ class RunRepair extends Command
// Overwrite supervisor config file
file_put_contents('/etc/supervisor/conf.d/phyre.conf', $supervisorConf);
// Restart supervisor
shell_exec('service supervisor restart');

View file

@ -10,14 +10,15 @@ class BackupLog extends Component
public $backupLog;
public $backupLogFile = '';
public function pullBackupLog()
{
$findBackup = \App\Models\Backup::where('id', $this->backupId)->first();
if ($findBackup) {
$backupLog = $findBackup->path . '/backup.log';
if (file_exists($backupLog)) {
$backupLogContent = file_get_contents($backupLog);
if ($this->backupLogFile) {
if (file_exists($this->backupLogFile)) {
$backupLogContent = shell_exec('tail -n 1000 ' . $this->backupLogFile);
// Get last 1000 lines of the log
$backupLogContent = substr($backupLogContent, -5000, 5000);
$backupLogContent = str_replace("\n", "<br>", $backupLogContent);
@ -25,10 +26,17 @@ class BackupLog extends Component
$this->backupLog = $backupLogContent;
}
}
}
public function mount($backupId)
{
$this->backupId = $backupId;
$findBackup = \App\Models\Backup::where('id', $this->backupId)->first();
if ($findBackup) {
$this->backupLogFile = $findBackup->path . '/backup.log';
$this->pullBackupLog();
}
}
public function render()