Skip to content

Instantly share code, notes, and snippets.

@seven1m
Created March 4, 2009 22:12
Show Gist options
  • Save seven1m/74043 to your computer and use it in GitHub Desktop.
Save seven1m/74043 to your computer and use it in GitHub Desktop.
#!/bin/sh
# rotating snapshotted backup
src=/my/stuff
dest=/var/backup
today=`date +%a`
yesterday=`date -d yesterday +%a`
mkdir -p $dest/$yesterday # in case it doesn't exist yet
rm -rf $dest/$today # I think this might be necessary -- not sure
cp -al $dest/$yesterday $dest/$today
rsync -ra --delete $src/* $dest/$today
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment