Last active
April 15, 2019 14:25
-
-
Save belst/b0dbbf60b13b0e69bda21d34e72b826b to your computer and use it in GitHub Desktop.
Incremental rsync backup script
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
#!/usr/bin/env bash | |
SOURCE=/home/belst/ | |
TARGET="backup:~/backup/home/belst/" # Trailing / is needed | |
TODAY=$(date +%Y-%m-%d) | |
ssh backup mkdir -p "${TARGET#*:}${TODAY}" | |
rsync -avR --delete "${SOURCE}" "${TARGET}${TODAY}/" --link-dest="${TARGET#*:}last" | |
ssh backup ln -nsf "${TARGET#*:}${TODAY}" "${TARGET#*:}last" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment