-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcouchpsync
More file actions
executable file
·24 lines (19 loc) · 789 Bytes
/
Copy pathcouchpsync
File metadata and controls
executable file
·24 lines (19 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
#
# Thomas Gotzsche
#
Sets up replication documents for all databases from one couchdb server to another one.
#
if [ -z "$2" ]; then
cat <<EOF
Usage: $0 <sourceUrl> <targetUrl>
Sets up replication documents for all databases from one couchdb server to another one.
Example: $0 example.com:5984 admin:admin@localhost:5984
EOF
exit 1
fi
DBNAMES=`curl -s -X GET $1/_all_dbs | sed 's/\[//;s/\]//;s/"_[a-z]*"//g;s/[,\"]/ /g'`
for i in $DBNAMES; do
curl -X POST http://$2/_replicator -d '{"source":"'http://$1/$i'", "target":"http://'$2/$i'", "continuous":true}' -H "Content-Type: application/json"
curl -X POST http://$1/_replicator -d '{"source":"'http://$2/$i'", "target":"'http://$1/$i'", "continuous":true}' -H "Content-Type: application/json"
done