Skip to content

Instantly share code, notes, and snippets.

@itstommymorgan
Forked from cdmwebs/time_machine.sh
Created January 11, 2009 05:28
Show Gist options
  • Save itstommymorgan/45649 to your computer and use it in GitHub Desktop.
Save itstommymorgan/45649 to your computer and use it in GitHub Desktop.
#!/bin/sh
HOST=cdmwebs.homedns.org
SOURCE=/Users/chris
INCLUDE=/Users/chris/bin/include.txt
PATHTOBACKUP=/media/storage/backups/panthera
PID=`pidof -s /bin/sh /Users/chris/bin/time_machine.sh`
# No more changes.
if [ $PID != $$ ]; then
echo "old rsync still running"
exit
fi
date=`date "+%Y-%m-%dT%H:%M:%S"`
/opt/local/bin/rsync -avzPE --delete --link-dest=$PATHTOBACKUP/Latest/ \
--include-from=$INCLUDE \
$SOURCE/ $HOST:$PATHTOBACKUP/$date/
# Recreate the symlink
ssh $HOST "rm $PATHTOBACKUP/Latest && ln -s $date $PATHTOBACKUP/Latest"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment