Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iml-backup
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
iml-backup
Merge requests
!106
skip couchdb backup if seq id is ureadable
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
skip couchdb backup if seq id is ureadable
message-on-no-sequenceid-couchdb2
into
master
Overview
0
Commits
1
Pipelines
0
Changes
1
Merged
Hahn Axel (hahn)
requested to merge
message-on-no-sequenceid-couchdb2
into
master
2 years ago
Overview
0
Commits
1
Pipelines
0
Changes
1
Expand
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
229d9565
1 commit,
2 years ago
1 file
+
28
−
23
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
plugins/localdump/couchdb2.sh
+
28
−
23
Options
@@ -4,7 +4,11 @@
# LOCALDUMP :: COUCHDB2 - using nodejs tools couchbackup and couchrestore
# https://github.com/cloudant/couchbackup
#
# creates gzipped plain text backups (JSON) from each scheme
# Backup:
# - creates gzipped plain text backups (JSON) from each scheme
# - write sequence id into a text file
# - store extra file with security infos
# - latest backup set is written to archive
#
# --------------------------------------------------------------------------------
# ah - Axel Hahn <axel.hahn@iml.unibe.ch>
@@ -22,6 +26,7 @@
# 2022-04-21 v1.7 restore security infos
# 2022-10-07 ah v1.8 unescape regex with space to prevent "grep: warning: stray \ before white space"
# 2023-06-06 ah v1.9 show a warning if the sequence id was not fetched
# 2023-06-12 ah v1.10 skip couchdb dump if no sequence id was detected (=db deleted since fetching list of all dbs)
# ================================================================================
if
[
-z
"
$BACKUP_TARGETDIR
"
]
;
then
@@ -223,31 +228,31 @@ function _doBackupOfSingleInstance(){
echo
"WARNING: unable to fetch current sequence ID - maybe the database was deleted."
else
echo
fi
echo
"update_seq --+-- current [
${
sSequenceCurrent
}
]"
echo
" +-- backup [
${
sSequenceLast
}
]"
echo
-n
"Need to backup ... "
couchbackup
--db
"
${
dbname
}
"
>
"
${
OUTFILE
}
"
.progress 2>/dev/null
&&
mv
"
${
OUTFILE
}
"
.progress
"
${
OUTFILE
}
"
fetchrc
# $myrc is last returncode - set in fetchrc
if
[
$myrc
-eq
0
]
;
then
echo
-n
"gzip ... "
compress_file
"
$OUTFILE
"
echo
"update_seq --+-- current [
${
sSequenceCurrent
}
]"
echo
" +-- backup [
${
sSequenceLast
}
]"
echo
-n
"Need to backup ... "
couchbackup
--db
"
${
dbname
}
"
>
"
${
OUTFILE
}
"
.progress 2>/dev/null
&&
mv
"
${
OUTFILE
}
"
.progress
"
${
OUTFILE
}
"
fetchrc
# $myrc is last returncode - set in fetchrc
if
[
$myrc
-eq
0
]
;
then
iDbCount+
=
1
cp
"
${
OUTFILE
}
"
*
"
${
ARCHIVFILE
}
"
\
&&
echo
"
${
sSequenceCurrent
}
"
>
"
${
SEQFILE
}
"
\
&&
_couchapi GET
"
${
dbname
}
/_security"
>
"
${
SECURITYFILE
}
"
ls
-l
"
${
ARCHIVFILE
}
"
"
${
SEQFILE
}
"
"
${
SECURITYFILE
}
"
echo
-n
"gzip ... "
compress_file
"
$OUTFILE
"
fetchrc
if
[
$myrc
-eq
0
]
;
then
iDbCount+
=
1
cp
"
${
OUTFILE
}
"
*
"
${
ARCHIVFILE
}
"
\
&&
echo
"
${
sSequenceCurrent
}
"
>
"
${
SEQFILE
}
"
\
&&
_couchapi GET
"
${
dbname
}
/_security"
>
"
${
SECURITYFILE
}
"
ls
-l
"
${
ARCHIVFILE
}
"
"
${
SEQFILE
}
"
"
${
SECURITYFILE
}
"
fi
else
echo
"ERROR occured while dumping - abort"
fi
else
echo
"ERROR occured while dumping - abort"
fi
ls
-l
"
$OUTFILE
"
*
echo
fi
ls
-l
"
$OUTFILE
"
*
echo
fi
# if [ -z "$sSequenceCurrent" ]; then
fi
# if [ "${sSequenceCurrent}" = "${sSequenceLast}" ] ...
done
rm
-f
"
$dblist
"
echo
"__DB__
$SERVICENAME
backup INFO:
${
COUCHDB_INSTANCE
}
- backed up
$iDbCount
dbs of
$iDbTotal
total"
Loading