Skip to content

Instantly share code, notes, and snippets.

@otsuarez
Created October 21, 2013 02:52
Show Gist options
  • Save otsuarez/7078003 to your computer and use it in GitHub Desktop.
Save otsuarez/7078003 to your computer and use it in GitHub Desktop.
backup script
if [ ! -d "~/bin" ]; then mkdir ~/bin ; fi
if [ ! -d "~/backups" ]; then mkdir ~/backups ; fi
cat >bin/backup-scripts.sh<<'EOF'
#!/bin/bash
DATE=`date +%Y%m%d_%H%M`
HOST=`hostname`
BASE_DIR=/usr/local/src
DIR=ansi-projects
FILE=$DIR-$HOST-$DATE.tgz
cd $BASE_DIR/$DIR
tar zcf ~/backups/$FILE $DIR/*
echo $FILE
EOF
chmod 755 bin/backup-scripts.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment