123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #!/bin/bash
- #copy study from one orthanc instance to another
- #works for orthanc 1.12.0, not for 1.6.1
- #reuqires source network json plus target network json
- function parse_cfg () {
- USER=$(jq -r ".orthanc.user" $1);
- PASSWORD=$(jq -r ".orthanc.password" $1);
- SERVER=$(jq -r ".orthanc.server" $1);
- }
- if [ $# -lt 1 ] ; then
- echo $#;
- echo Usage $0 sourceNetworkConfig targetNetworkConfig studyId
- exit 0;
- fi;
- FILE=$HOME/temp/Study.zip
- if [ -f $FILE ] ; then
- rm $FILE;
- fi;
- #parse source config
- parse_cfg $1;
- CURL="curl -u $USER:$PASSWORD"
- $CURL $SERVER/studies/$3/archive > $FILE;
- echo Downloaded study $3 to $FILE;
- #target config
- parse_cfg $2;
- CURL="curl -u $USER:$PASSWORD"
- R=$($CURL -X POST $SERVER/instances --data-binary "@$FILE" | jq -r ".[] | .Status");
- echo $R;
- rm $FILE;
|