Skip to content

Instantly share code, notes, and snippets.

@koseki
Created January 26, 2009 08:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koseki/52742 to your computer and use it in GitHub Desktop.
Save koseki/52742 to your computer and use it in GitHub Desktop.
手抜きバックアップ
#! /bin/sh
DIR=`dirname $0`
NOW=`date +"%Y%m%d%H%M%S"`
ORG="$DIR/htdocs"
BAK="$DIR/backup/htdocs-$NOW.tar.gz"
if [ -f $BAK ];
then
echo "Backup FAILED: $BAK already exists!"
exit
fi
echo "Backup: $ORG -> $BAK"
tar czf $BAK $ORG
#! /bin/sh
DIR=`dirname $0`
NOW=`date +"%Y%m%d%H%M%S"`
ORG="$DIR/htdocs/index.html"
BAK="$DIR/backup/index.html-$NOW"
if [ -f $BAK ];
then
echo "Backup FAILED: $BAK already exists!"
exit
fi
echo "Backup: $ORG -> $BAK"
cp $ORG $BAK
#! /bin/sh
DIR=`dirname $0`/htdocs
if [ -z "$1" ];
then
MSG="backup"
else
MSG="backup: $1"
fi
cd $DIR
git commit -am "$MSG"
#! /bin/sh
DIR=`dirname $0`
NOW=`date +"%Y%m%d%H%M%S"`
BAK="$DIR/all-$NOW.sql"
if [ -f $BAK ];
then
echo "Backup FAILED: $BAK already exists!"
exit
fi
mysqldump -u root -x --all-databases > $BAK
# gzip $BAK
#! /bin/sh
DIR=`dirname $0`/htdocs
cd $DIR
git init
git add .
git commit -m 'initial import'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment