check for storage requirement.

This commit is contained in:
Fabian Märki
2017-03-01 17:31:35 +01:00
parent 2810489693
commit 52f89d4a71

24
storage.sh Normal file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
HOST="https://dispatcher-api.psi.ch/sf"
# HOST="http://localhost:8080"
HTTP_ADDRESS="/configuration/test/storagerequirement"
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} -X POST"
while read -r -d '' filename; do
COMMAND+=" -F files=@${filename}"
done < <(find . \( -name "*rf*.sources" \) -print0)
# COMMAND="curl -H \"Content-Type: application/json\" -d '{\"sources\": [{\"stream\": \"tcp://SINEG01-CVME-LLRF1:20000\"},{\"stream\": \"tcp://SINEG01-CVME-LLRF2:20000\"}]}'"
COMMAND+=" ${HOST}${HTTP_ADDRESS} -o ${RESPONSE}"
echo "Execute command: "${COMMAND}
STATUS=$(${COMMAND})
cat ${RESPONSE} | python -m json.tool
rm -f ${RESPONSE}
#echo ${STATUS}