Update Backup.php

This commit is contained in:
Bozhidar Slaveykov 2024-10-02 11:05:30 +03:00 committed by GitHub
parent cff063b61a
commit 5d42587168
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -61,25 +61,26 @@ class Backup extends Model
public function checkCronJob() public function checkCronJob()
{ {
$cronJobCommand = 'phyre-php /usr/local/phyre/web/artisan phyre:run-backup-checks';
$findCronJob = CronJob::where('command', $cronJobCommand)->first();
if (! $findCronJob) {
$cronJob = new CronJob();
$cronJob->schedule = '*/5 * * * *';
$cronJob->command = $cronJobCommand;
$cronJob->user = 'root';
$cronJob->save();
}
$cronJobCommand = 'phyre-php /usr/local/phyre/web/artisan phyre:create-daily-full-backup'; //$cronJobCommand = 'phyre-php /usr/local/phyre/web/artisan phyre:run-backup-checks';
$findCronJob = CronJob::where('command', $cronJobCommand)->first(); //$findCronJob = CronJob::where('command', $cronJobCommand)->first();
if (! $findCronJob) { //if (! $findCronJob) {
$cronJob = new CronJob(); // $cronJob = new CronJob();
$cronJob->schedule = '0 0 * * *'; // $cronJob->schedule = '*/5 * * * *';
$cronJob->command = $cronJobCommand; //$cronJob->command = $cronJobCommand;
$cronJob->user = 'root'; //$cronJob->user = 'root';
$cronJob->save(); //$cronJob->save();
} //}
// $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 true; return true;
} }