Created
January 26, 2009 08:03
-
-
Save koseki/52742 to your computer and use it in GitHub Desktop.
手抜きバックアップ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
DIR=`dirname $0`/htdocs | |
if [ -z "$1" ]; | |
then | |
MSG="backup" | |
else | |
MSG="backup: $1" | |
fi | |
cd $DIR | |
git commit -am "$MSG" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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