Created
July 17, 2013 16:20
-
-
Save residentkrm/6022106 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/bash | |
home="/home/mangos" | |
mangosConf=$home"/etc/mangosd.conf" | |
scriptConf=$home"etc/scriptdev2.conf" | |
backup=$home"/backup" | |
# | |
############################################################################### | |
# functions | |
function db_config_extract() | |
{ | |
echo `cat $1|grep "^"$2 |sed 's/^.*=\t*//'|sed 's/\"//g' |sed 's/\<//'|sed 's/\>//'|sed 's/\;/ /g'` | |
} | |
############################################################################### | |
# realm | |
dtemp=$(db_config_extract $mangosConf "LoginDatabaseInfo") | |
read realmhost realmport realmuser realmpass realmdb <<<$dtemp | |
mysqldump -h$realmhost -P$realmport -u$realmuser -p$realmpass $realmdb > "$backup/$realmdb".sql | |
echo "Backing up database '$realmdb' completed." | |
# | |
############################################################################### | |
# characters | |
dtemp=$(db_config_extract $mangosConf "CharacterDatabaseInfo") | |
read characterhost characterport characteruser characterpass characterdb <<<$dtemp | |
mysqldump -h$characterhost -u$characteruser -p$characterpass $characterdb > "$backup/$characterdb".sql | |
echo "Backing up database '$characterdb' completed." | |
# | |
############################################################################### | |
# world | |
dtemp=$(db_config_extract $mangosConf "WorldDatabaseInfo") | |
read mangoshost mangossport mangosuser mangospass mangosdb <<<$dtemp | |
mysqldump -h$mangoshost -u$mangosuser -p$mangospass $mangosdb > "$backup/$mangosdb".sql | |
echo "Backing up database '$mangosdb' completed." | |
# | |
############################################################################### | |
# scripts | |
dtemp=$(db_config_extract $scriptConf "ScriptDev2DatabaseInfo") | |
read sdhost sdport sduser sdpass sddb <<<$dtemp | |
mysqldump -h$sdhost -u$sduser -p$sdpass $sddb > "$backup/$sddb".sql | |
echo "Backing up database '$sddb' completed." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment