Created
November 25, 2019 10:26
-
-
Save vjrj/ae539c08ee04350a43e2bc2bbe7b5b6b to your computer and use it in GitHub Desktop.
Basic LA record consumers test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage "check-dr-linked-record-consumers.sh dr225 dr226" | |
# | |
ERRORS=0 | |
DEBUG=1 | |
drs=$1 | |
for dr in $(echo $drs | tr "," "\n") | |
do | |
EXIST=$(curl -s https://colecciones.gbif.es/ws/eml/$dr) | |
if [[ $EXIST == "no such entity $dr" ]] | |
then | |
echo "ERROR: No such resource $dr" | |
ERRORS=$[ERRORS + 1] | |
else | |
REC=$(curl -s https://colecciones.gbif.es/ws/dataResource/$dr | jq .linkedRecordConsumers) | |
if [[ $REC == "null" ]] | |
then | |
echo "WARN: Incorrect linked record consumers for $dr" | |
echo "https://colecciones.gbif.es/ws/dataResource/$dr" | |
ERRORS=$[ERRORS + 1] | |
else | |
if [[ $DEBUG -eq 1 ]] ; then echo "INFO: Linked record consumers for $dr: $REC"; fi | |
fi | |
fi | |
done | |
if [[ $ERRORS -gt 0 ]] | |
then | |
exit 1 | |
else | |
exit 0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment