3

I am using "spatie/laravel-backup": "^6.16" in a Laravel 8 project. My cleanup setup is by default. I have the following schedules commands on

My Kernel.php:

protected function schedule(Schedule $schedule)
{
    $schedule->command('backup:clean')->daily()->at('22:30')->appendOutputTo(storage_path('logs/laravel.log'));
    $schedule->command('backup:run')->daily()->at('22:35')->appendOutputTo(storage_path('logs/laravel.log'));
    // $schedule->command('inspire')->hourly();
}

I have a cron configured on my server that runs schedule:run every minute. Everything works great, The backups are successful, they are saved in Storage/App/Laravel folder and I get the successful emails (from both scgeducommands).

The email I get everyday of backup:clean command

Hello! The clean up of the Laravel backups on the disk named local was successful. Application name: Laravel Backup name: Laravel Disk: local Newest backup size: 16.9 MB Number of backups: 17 Total storage used: 276.86 MB Newest backup date: 2022/10/27 22:35:03 Oldest backup date: 2022/10/11 22:35:03 Regards, Laravel

The email I get everyday of backup:run command

Hello! Great news, a new backup of Laravel was successfully created on the disk named local. Application name: Laravel Backup name: Laravel Disk: local Newest backup size: 16.97 MB Number of backups: 18 Total storage used: 293.83 MB Newest backup date: 2022/10/28 22:35:02 Oldest backup date: 2022/10/11 22:35:03 Regards, Laravel

The problem is that old backups do not get deleted. I stacked 18 already and it should stack only 16 according to Backup.php cleanup config by default. What should I do to only keep the backups from the last 16 days? I do not get any log error or email error.

Thank you in advance!

STA
  • 30,729
  • 8
  • 45
  • 59
Taten
  • 31
  • 2

0 Answers0