Skip to content

Backup Strategy for different backups #1074

Answered by Muetze42
Muetze42 asked this question in Q&A
Discussion options

You must be logged in to vote

I have now created my own Cleanup Command. Here are the code snippets, maybe someone else can use them.

Situation for this snippet:
3 different backups on two disks (local & backup-ftp)

  1. database backup
  • hourly
  • Cleanup: 7 days
  • File prefix: database_
  1. images backup
  • daily
  • Cleanup: 2 days
  • File prefix: images_
  1. music backup
  • manually
  • Cleanup: Manual
  • File prefix: music_

My Schedule

        $schedule->command('clean:backup')->daily()->at('03:00');
        $schedule->command('backup:run --only-files --filename=images_'.Carbon::now()->format('Y-m-d-H-i-s').'.zip')->daily()->at('05:00');
        $schedule->command('backup:run --only-db --filename=database_'.Carbon::now()->format('Y-m-d-H-i-s'

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Muetze42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant