0

I have a shell script that i'll be running with a crontab. Basically I want to modify this so I can do daily backups for the last 3 days. I've seen examples where the last 7 days are backup. I just need the last 3 rolling days. I know I would have to do a separate script for the weekly schedule.

code:

rsync -avzh --delete XXXX@XXXXX:/home/XXXXX/source/ /$HOME/destination

Any help is greatly appreciated.

5

Someone has already written a script that does this, and it has a lot of great features, plus it has been tested by many people for years. It is called "rsnapshot".

I highly recommend "rsnapshot". It is easy to configure and will do a 3-day retention, or even more complex retention policies.

http://www.rsnapshot.org/

5
  • I will investigate on this. So that means that you can't do this with rsync? will rsnapshot work with crontab? – Rene Merino Jun 18 '14 at 20:19
  • To be clear, rsnapshot is just a script that calls rsync. It just does all the complexities of expiring old snapshots for you. – TomOnTime Jun 18 '14 at 20:21
  • I see, does this work on ubuntu? is not listed in their website – Rene Merino Jun 18 '14 at 20:22
  • @ReneMerino It works perfectly fine on Debian, which is still pretty close to Ubuntu. Why don't you try it yourself? Just use a smaller dataset if you want to speed things up while you're testing. – user Jun 18 '14 at 20:24
  • I installed it in my server, I hope this works - Thanks @TomOnTime – Rene Merino Jun 18 '14 at 20:24
0

Maybe you also want to take a look at http://backuppc.sourceforge.net/

It's more than just a script, it's a server side solution for backing up multiple servers. Maybe a bit too much for you, but also very popular.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.