add stop image command

This commit is contained in:
2019-05-06 11:45:41 +02:00
parent 7d3ba1133f
commit ef6cb8f60c

20
stop_images.sh Executable file
View File

@@ -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}