Skip to content

Instantly share code, notes, and snippets.

@neolao
Created January 5, 2011 18:00
Show Gist options
  • Save neolao/766694 to your computer and use it in GitHub Desktop.
Save neolao/766694 to your computer and use it in GitHub Desktop.
#!/bin/bash
source=myLogin@hostname:
snapshotDir=/path/to/backup/dir
if [ -d $snapshotDir/hourly.3 ]
then
rm -rf $snapshotDir/hourly.3
fi
if [ -d $snapshotDir/hourly.2 ]
then
mv $snapshotDir/hourly.2 $snapshotDir/hourly.3
fi
if [ -d $snapshotDir/hourly.1 ]
then
mv $snapshotDir/hourly.1 $snapshotDir/hourly.2
fi
if [ -d $snapshotDir/hourly.0 ]
then
cp -al $snapshotDir/hourly.0 $snapshotDir/hourly.1
fi
rsync -va --delete -e ssh $source $snapshotDir/hourly.0
touch $snapshotDir/hourly.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment