forked from jmakeig/marklogic-bootstrapping
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquery-console.sh
More file actions
executable file
·24 lines (19 loc) · 976 Bytes
/
query-console.sh
File metadata and controls
executable file
·24 lines (19 loc) · 976 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bash
# Downloads Query Console workspaces to the current working directory in the format {host}_{workspace id}_{timestamp}.workspace.
if command -v jq >/dev/null; then
:
else
echo 'You need jq in order to parse JSON. <http://stedolan.github.io/jq/>'
exit 1
fi
HOST=jmakeig-centos6-virtualbox.localdomain
USER=admin
PASSWORD='********'
curl -fsS "http://$HOST:8000/qconsole/endpoints/workspaces.xqy" --digest --user "$USER":"$PASSWORD" | jq --raw-output '.[].workspace[].id' | while read -r line; do
# Export
printf "Exporting workspace $line from $HOST\n"
curl -fsS "http://$HOST:8000/qconsole/endpoints/workspaces.xqy?wsid=$line&format=export" --digest --user "$USER":"$PASSWORD" > "$HOST"_"$line"_$(date +"%Y-%m-%dT%H:%M:%SZ").workspace
# Delete
#printf "Deleting workspace $line from $HOST\n"
#curl -fsS "http://$HOST:8000/qconsole/endpoints/workspaces.xqy?wsid=$line" -X DELETE --digest --user "$USER":"$PASSWORD" 1>/dev/null
done