Skip to content
Snippets Groups Projects
Commit b9bdc0e4 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

Merge branch 'version-2' into 'master'

couchdb2 v1.2  added fastmode in restore

See merge request !15
parents ea080218 ecb6735d
Branches
No related tags found
1 merge request!15couchdb2 v1.2 added fastmode in restore
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment