final stage
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schedule;
|
||||
use App\Services\BackupService;
|
||||
use App\Models\AppSetting;
|
||||
|
||||
Schedule::call(function () {
|
||||
try {
|
||||
@@ -10,3 +12,19 @@ Schedule::call(function () {
|
||||
\Illuminate\Support\Facades\Log::error('Scheduled email sync failed', ['error' => $e->getMessage()]);
|
||||
}
|
||||
})->name('email:sync')->everyFifteenMinutes()->withoutOverlapping();
|
||||
|
||||
// Backup automatico
|
||||
Schedule::call(function () {
|
||||
if (!AppSetting::getSetting('backup_auto_enabled', false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
(new BackupService())->run();
|
||||
} catch (\Exception $e) {
|
||||
\Illuminate\Support\Facades\Log::error('Scheduled backup failed', ['error' => $e->getMessage()]);
|
||||
}
|
||||
})->name('backup:auto')
|
||||
->dailyAt((string) (AppSetting::getSetting('backup_auto_hour', 3) . ':00'))
|
||||
->withoutOverlapping()
|
||||
->onOneServer();
|
||||
|
||||
Reference in New Issue
Block a user