Skip to content

Instantly share code, notes, and snippets.

@chtitux
Created October 23, 2010 23:34
Show Gist options
  • Save chtitux/642828 to your computer and use it in GitHub Desktop.
Save chtitux/642828 to your computer and use it in GitHub Desktop.
#!/bin/sh
# from http://blog.interlinked.org/tutorials/rsync_time_machine.html
# T.Helleboid <t.helleboid@iariss.fr>
date=`date "+%Y-%m-%dT%H-%M-%S"`
BACKUPED_DIR=/home/chtitux/backup/
BACKUPED_HOST=hobbes.chtitux.org
BACKUPED_USER=chtitux
BACKUP_DIR=/home/chtitux/backups/
# -6 is for IPv6 ONLY
# $BACKUP_DIR/rsync-exclude has to exist
# RTFM rsync too ;)
rsync -6 --archive --one-file-system --hard-links \
--human-readable --inplace --numeric-ids --delete \
--partial --progress \
--compress \
--delete-excluded \
--exclude-from=$BACKUP_DIR/rsync-exclude \
--link-dest=$BACKUP_DIR/current \
$USER@$BACKUPED_HOST:$BACKUPED_DIR $BACKUP_DIR/incomplete_back-$date \
mv $BACKUP_DIR/incomplete_back-$date $BACKUP_DIR/back-$date \
&& rm -f $BACKUP_DIR/current \
&& ln -s back-$date $BACKUP_DIR/current
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment