diff --git a/plugins/localdump/couchdb2.sh b/plugins/localdump/couchdb2.sh index 32e3be431da5f207945fe97492ed253fdbf12257..f6aa7826624b16dbe452121c7e58f648332ca791 100755 --- a/plugins/localdump/couchdb2.sh +++ b/plugins/localdump/couchdb2.sh @@ -13,6 +13,8 @@ # 2019-11-13 ..... v1.0 initial version with backup and restore (single DB) # 2020-05-19 ..... v1.1 backup a single or multiple couchdb instances by globbing param # ./localdump.sh backup couchdb2 demo +# 2021-10-11 ..... v1.2 added fastmode in restore: no test connect, do not +# delete DB before create request # ================================================================================ if [ -z $BACKUP_TARGETDIR ]; then @@ -203,6 +205,8 @@ function _doBackupOfSingleInstance(){ function restoreByFile(){ sMyfile=$1 sMyDb=$2 + bFastMode=1 + echo h2 "analyze dump $sMyfile" @@ -218,20 +222,21 @@ function restoreByFile(){ echo loadInstance $COUCHDB_INSTANCE - - echo connect $couchdbhost on port $couchdbport with user $couchdbuser - curl --head -X GET $COUCH_URL 2>/dev/null | grep "^HTTP.*\ 200\ " >/dev/null - if [ $? -ne 0 ]; then - color error - echo ERROR: couch DB instance is not available - curl -X GET $COUCH_URL + + if [ $bFastMode -eq 0 ]; then + echo connect $couchdbhost on port $couchdbport with user $couchdbuser + curl --head -X GET $COUCH_URL 2>/dev/null | grep "^HTTP.*\ 200\ " >/dev/null + if [ $? -ne 0 ]; then + color error + echo ERROR: couch DB instance is not available + curl -X GET $COUCH_URL + color reset + exit 1 + fi + color ok + echo OK color reset - exit 1 fi - color ok - echo OK - color reset - echo @@ -240,11 +245,13 @@ function restoreByFile(){ # echo DB exists ... need to drop it first # fi - h2 deleting database [$sMyDb] ... - color cmd - _couchapi DELETE $sMyDb - fetchrc - color reset + if [ $bFastMode -eq 0 ]; then + h2 deleting database [$sMyDb] ... + color cmd + _couchapi DELETE $sMyDb + fetchrc + color reset + fi h2 creating database [$sMyDb] ... color cmd