This commit is contained in:
Bozhidar 2024-05-01 01:46:33 +03:00
parent 72e7229539
commit 6ed95760b5
2 changed files with 14 additions and 2 deletions

View file

@ -16,7 +16,7 @@ class RunBackup extends Command
*
* @var string
*/
protected $signature = 'phyre:run-backup';
protected $signature = 'phyre:run-backup-checks';
/**
* The console command description.

View file

@ -54,7 +54,7 @@ class Backup extends Model
public function checkCronJob()
{
$cronJobCommand = 'phyre-php /usr/local/phyre/web/artisan phyre:run-backup';
$cronJobCommand = 'phyre-php /usr/local/phyre/web/artisan phyre:run-backup-checks';
$findCronJob = CronJob::where('command', $cronJobCommand)->first();
if (! $findCronJob) {
$cronJob = new CronJob();
@ -64,6 +64,18 @@ class Backup extends Model
$cronJob->save();
return false;
}
$cronJobCommand = 'phyre-php /usr/local/phyre/web/artisan phyre:create-daily-full-backup';
$findCronJob = CronJob::where('command', $cronJobCommand)->first();
if (! $findCronJob) {
$cronJob = new CronJob();
$cronJob->schedule = '0 0 * * *';
$cronJob->command = $cronJobCommand;
$cronJob->user = 'root';
$cronJob->save();
return false;
}
return true;
}