diff --git a/stop_images.sh b/stop_images.sh new file mode 100755 index 0000000..92a4c40 --- /dev/null +++ b/stop_images.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +HOST="https://dispatcher-api.psi.ch/sf" +# HOST="http://localhost:8080" +HTTP_ADDRESS="/source" +RESPONSE=response.json +# see http://stackoverflow.com/questions/18258804/how-to-catch-timeout-errors-in-a-curl-shell-script +COMMAND="curl -s -w %{http_code} -H \"Content-Type: application/json\" -X DELETE" + +while read -r -d '' filename; do + COMMAND+=" -F files=@${filename}" +done < <(find . \( -name "image.sources" \) -print0) + +COMMAND+=" ${HOST}${HTTP_ADDRESS} -o ${RESPONSE}" +# echo "Execute command: "${COMMAND} +STATUS=$(${COMMAND}) + +cat ${RESPONSE} | python -m json.tool +rm -f ${RESPONSE} +#echo ${STATUS}