Update restore.sh

This commit is contained in:
mirocow 2016-02-16 13:55:25 +04:00
parent 81fc75d36f
commit 488c209924

View file

@ -20,7 +20,11 @@ database_exists()
f_log() f_log()
{ {
logger "RESTORE: $@" logger "RESTORE: $@"
if [ $VERBOSE -eq 1 ]; then
echo "BACKUP: $@"
fi
} }
restore() restore()
@ -157,8 +161,8 @@ This script restore databases.
OPTIONS: OPTIONS:
-e Exclude databases -e Exclude databases
-s Selected databases -s Selected databases
-c Check innochecksum of table after import -c Check innochecksum of table after import
EOF EOF
} }
@ -168,6 +172,8 @@ if [ $# = 0 ]; then
exit; exit;
fi fi
BACKUP_DIR=$(pwd)
BIN_DEPS="ls grep awk sort uniq bunzip2 bzip2 mysql" BIN_DEPS="ls grep awk sort uniq bunzip2 bzip2 mysql"
if [ -f '/etc/debian_version' ]; then if [ -f '/etc/debian_version' ]; then
@ -187,18 +193,18 @@ done
for i in "$@" for i in "$@"
do do
case $i in case $i in
-e) -e)
DATABASES_SKIP=( "${i#*=}" ) DATABASES_SKIP=( "${i#*=}" )
shift shift
;; ;;
-s) -s)
DATABASES_SELECTED=( "${i#*=}" ) DATABASES_SELECTED=( "${i#*=}" )
shift shift
;; ;;
-c) -c)
DATABASES_TABLE_CHECK=1 DATABASES_TABLE_CHECK=1
shift shift
;; ;;
--config=*) --config=*)
CONFIG_FILE=( "${i#*=}" ) CONFIG_FILE=( "${i#*=}" )
shift # past argument=value shift # past argument=value
@ -217,6 +223,15 @@ do
esac esac
done done
# === SETTINGS ===
f_log "============================================"
f_log "Dump into: $BACKUP_DIR"
f_log "Config file: $CONFIG_FILE"
f_log "Verbose: $VERBOSE"
f_log "Selected databases: $DATABASES_SELECTED"
f_log "============================================"
f_log ""
# === AUTORUN === # === AUTORUN ===
restore $(pwd) restore $(pwd)