Skip to content

Instantly share code, notes, and snippets.

@egermano
Created May 15, 2015 22:19
Show Gist options
  • Save egermano/241810b26878a3c0ab32 to your computer and use it in GitHub Desktop.
Save egermano/241810b26878a3c0ab32 to your computer and use it in GitHub Desktop.
Cloud time machine
#!/bin/sh
date=`date "+%Y-%m-%dT%H_%M_%S"`
HOME=/Users/path
rsync -azP \
--delete \
--delete-excluded \
--exclude-from=$HOME/.Trash \
--exclude-from=$HOME/.cache \
--exclude-from=$HOME/Dropbox \
--exclude-from=$HOME/odrive \
--link-dest=../current \
$HOME user@server.com:~/backups/Inesplorato/incomplete_back-$date \
&& ssh user@server.com \
"mv ~/backups/Inesplorato/incomplete_back-$date ~/backups/back-$date \
&& rm -f ~/backups/Inesplorato/current \
&& ln -s back-$date ~/backups/Inesplorato/current"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment