Created
July 5, 2012 05:56
-
-
Save petrockblog/3051628 to your computer and use it in GitHub Desktop.
Rotating backup with rsync
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BACKUPPATHS=( "BACKUPUPDIR1" "BACKUPDIR2" "BACKUPDIR3" ) | |
TARGETPATHS=( "TARGETOFBACKUPDIR1" "TARGETOFBACKUPDIR2" "TARGETOFBACKUPDIR3" ) | |
for (( k=0 ; k < ${#BACKUPPATHS[@]} ; k++ )) | |
do | |
echo -e "Making backup of ${BACKUPPATHS[$k]}" | |
rsync -avz --delete --link-dest=${TARGETPATHS[$k]}/`date +%a -d "-1 day"` ${BACKUPPATHS[$k]} ${TARGETPATHS[$k]}/`date +%a` | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment