Skip to content

Instantly share code, notes, and snippets.

@eddyxu
Created March 28, 2010 05:15
Show Gist options
  • Save eddyxu/346589 to your computer and use it in GitHub Desktop.
Save eddyxu/346589 to your computer and use it in GitHub Desktop.
backup git repos
#!/bin/sh
TIMESTAMP=`date +"%F"`
SRC_PATH="/base/src/path"
TAR_PATH="/target/path"
if [ ! -d $TAR_PATH ]; then
mkdir -p $TAR_PATH
fi
tar -cjf $TAR_PATH/git-$TIMESTAMP.tar.bz -C $SRC_PATH git
find $TAR_PATH -ctime 30 -type f -delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment