Comments (4)
I've run into this with sed. Apparently (and I think this was changed recently), sed requires a backup filename option to be specified - notice the empty parentheses. Example below of code that will throw error, and that which will solve it:
throws same error:
sed -i 's|_oldstring|new_string|' test.json
works on OSX 10.11:
sed -i '' 's|_oldstring|new_string|' test.json
from couchdb-dump.
Pretty odd; could you throw us the output from:
bash -x couchdb-backup.sh -b -H 127.0.0.1 -d test -f test.json
Be sure to strip out any sensitive information from the output- but that should make it nice and clear what's going wrong :)
from couchdb-dump.
Thanks for your reply. Here is the output ...
+ scriptversionnumber=1.1.1
+ '[' x-b = x ']'
+ username=
+ password=
+ backup=false
+ restore=false
+ port=5984
+ OPTIND=1
+ lines=5000
+ attempts=3
+ getopts ':h?H:d:f:u:p:P:l:t:a:V?b?B?r?R?' opt
+ case "$opt" in
+ backup=true
+ getopts ':h?H:d:f:u:p:P:l:t:a:V?b?B?r?R?' opt
+ case "$opt" in
+ url=127.0.0.1
+ getopts ':h?H:d:f:u:p:P:l:t:a:V?b?B?r?R?' opt
+ case "$opt" in
+ db_name=test
+ getopts ':h?H:d:f:u:p:P:l:t:a:V?b?B?r?R?' opt
+ case "$opt" in
+ file_name=test.json
+ getopts ':h?H:d:f:u:p:P:l:t:a:V?b?B?r?R?' opt
+ shift 7
+ '[' '' = -- ']'
+ '[' '!' x = x ']'
+ '[' true = true ']'
+ '[' false = true ']'
+ '[' true = false ']'
+ '[' x127.0.0.1 = x ']'
+ '[' xtest = x ']'
+ '[' xtest.json = x ']'
+ file_name_orig=test.json
++ uname -a
++ grep -ci darwin
+ '[' '!' 1 = 0 ']'
++ sysctl -n hw.ncpu
+ cores=8
+ '[' '!' x = x ']'
++ expr 8 - 1
+ threads=7
+ case $attempts in
+ true
++ echo 127.0.0.1
++ grep -c http
+ '[' '!' 0 = 1 ']'
+ url=http://127.0.0.1
++ echo http://127.0.0.1
++ egrep -c ':[0-9]*$'
+ '[' '!' 0 = 1 ']'
+ url=http://127.0.0.1:5984
+ '[' '!' x = x ']'
+ '[' '!' x = x ']'
+ '[' '!' x = x ']'
++ echo http://127.0.0.1:5984
++ grep -ic '^https://'
+ '[' 0 = 1 ']'
++ which curl
+ '[' x/usr/bin/curl = x ']'
+ '[' true = true ']'
+ '[' false = false ']'
+ '[' -f test.json ']'
+ curl -X GET 'http://127.0.0.1:5984/test/_all_docs?include_docs=true&attachments=true' -o test.json
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 5363 0 5363 0 0 2647k 0 --:--:-- --:--:-- --:--:-- 5237k
+ '[' '!' 0 = 0 ']'
++ head -n 1 test.json
++ grep '^{"error'
+ ERR_CHECK=
+ '[' '!' x = x ']'
++ file test.json
++ grep -c CRLF
+ '[' 1 = 1 ']'
+ echo '... INFO: File contains Windows carridge returns- converting...'
... INFO: File contains Windows carridge returns- converting...
++ du -P -k test.json
++ awk '{print$1}'
+ filesize=8
+ checkdiskspace test.json 8
+ location=test.json
+ KBrequired=8
+ '[' xtest.json = x ']'
+ '[' x8 = x ']'
+ stripdir=test.json
++ df -P -k test.json
++ tail -n 1
++ awk '{print$4}'
++ sed -e 's/K$//'
+ KBavail=121838972
+ '[' 121838972 -ge 8 ']'
+ return 0
+ tr -d '\r'
+ '[' 0 = 0 ']'
+ mv test.json.tmp test.json
+ '[' 0 = 0 ']'
+ echo '... INFO: Completed successfully.'
... INFO: Completed successfully.
+ echo '... INFO: Amending file to make it suitable for Import.'
... INFO: Amending file to make it suitable for Import.
+ echo '... INFO: Stage 1 - Document filtering'
... INFO: Stage 1 - Document filtering
++ du -P -k test.json
++ awk '{print$1}'
+ '[' 8 -ge 256000 ']'
++ wc -l test.json
++ awk '{print$1}'
+ KBreduction=0
++ du -P -k test.json
++ awk '{print$1}'
+ filesize=8
++ expr 8 - 0
+ filesize=8
+ checkdiskspace test.json 8
+ location=test.json
+ KBrequired=8
+ '[' xtest.json = x ']'
+ '[' x8 = x ']'
+ stripdir=test.json
++ df -P -k test.json
++ tail -n 1
++ awk '{print$4}'
++ sed -e 's/K$//'
+ KBavail=121838972
+ '[' 121838972 -ge 8 ']'
+ return 0
+ sed -i 's/.*,"doc"://g' test.json
sed: 1: "test.json": undefined label 'est.json'
+ '[' '!' 1 = 0 ']'
+ echo 'Stage failed.'
Stage failed.
+ exit 1
from couchdb-dump.
Same as #36 - fix has been merged.
from couchdb-dump.
Related Issues (20)
- Backup / restore all databases? HOT 4
- Stuck at 'Stage 1 - Document filtering' HOT 6
- Taking backup for all revisions HOT 1
- Is it possible to set the password with a environment variable? HOT 4
- ERROR: Curl encountered an issue whilst dumping the database HOT 1
- Backup exits with exitcode 1 in silent mode HOT 1
- can dump all revisions docs HOT 4
- Error when restoring: POST body must include `docs` parameter. HOT 4
- Document update conflict upon restore HOT 3
- couchdb-dump doesn't work with busybox's grep anymore HOT 1
- Backup all databases HOT 9
- Invalid UTF-8 JSON error while restoring large file HOT 5
- Restore backup into non-empty database HOT 1
- Backup does not work with pouchdb-server
- Question: How does the restore handle duplicate data? HOT 1
- compilation_error when attempting to restore database
- CouchDB Reported error, need some advice on how to debug HOT 1
- How can exclude some databases from backup? HOT 1
- Nice to have a 'drop database' option
- Intermittent backup issue HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from couchdb-dump.