-
-
Save robacarp/e0e3040a929aac6b6a5d to your computer and use it in GitHub Desktop.
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 | |
#remote backup host | |
host=robert@192.168.55.22 | |
#directory to store backups on $host | |
dir=/mnt/TB/basilius | |
#the name of todays backup folder..... | |
name=`date "+%Y-%m-%d-%H-%M"` | |
#most recent folder modified in the remote backup store | |
prev_dirs=$(ssh $host "/bin/bash -c \"ls -At $dir\"" | head -n3) | |
#setup the hardlinking for the remote system | |
hardlinks="" | |
for file in $prev_dirs; do | |
hardlinks="$hardlinks --link-dest=$dir/$file" | |
done | |
# #archive implies: | |
# --recursive \ | |
# --links \ | |
# --perms \ | |
# --times \ | |
# --owner \ | |
# --group \ | |
# --device \ | |
# --specials \ | |
# the old style.... | |
# --backup --backup-dir=.backup/$date --delete-after \ | |
rsync --human-readable --progress --stats \ | |
--filter='merge rsync-filters.txt' \ | |
--archive \ | |
$hardlinks \ | |
--hard-links \ | |
--compress \ | |
~/ $host:$dir/$name | |
echo Backup to $host:$dir/$name finished. | |
#mark the backup as completed | |
ssh $host "/bin/bash -c \"touch $dir/$name/.completed; ln -sf $dir/$name $dir/last-backup\"" |
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
- .dropbox/* | |
- *.app | |
- Library/** | |
- .Trash/** | |
- .cpan/** | |
- .rvm/** | |
- */Documents/Virtual Machines.localized** | |
- Documents/Adobe/Premiere\ Pro* | |
- *.DS_Store | |
+ */.git/config | |
+ */.git/FETCH_HEAD | |
+ */.git/HEAD | |
+ */.git/ORIG_HEAD | |
+ */.git/COMMIT_EDITMSG | |
- */.git/** | |
- *.gem | |
- *.vmdk | |
- */cache/* | |
- VirtualBox VMs/**/Snapshots/* | |
- Documents/eclipse-workspace/* | |
- .sbt/* | |
- Sites/davinci/uploads/* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment