Skip to content

Instantly share code, notes, and snippets.

@randomcamel
Created June 14, 2021 16:59
Show Gist options
  • Save randomcamel/8e5a8f72a163236768267e9ca7ae4dc1 to your computer and use it in GitHub Desktop.
Save randomcamel/8e5a8f72a163236768267e9ca7ae4dc1 to your computer and use it in GitHub Desktop.
#!/bin/sh
# uses rsync's hard-link feature to mimic the function and structure of Apple's Time Machine.
# my server's name is 'shiny', which I evidently used to mount on /backup.
TARGET=/backup/shiny
date=`date "+%Y-%m-%dT%H:%M:%S"`
rsync --exclude=.AppleDouble -aCPv --link-dest=$TARGET/current $HOME $TARGET/back-$date
cd $TARGET
rm current
ln -s back-$date current
# I had this disabled, but it was a nice touch.
touch $TARGET/../.last-rsync
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment