diff --git a/scripts/geoloc-members-json.sh b/scripts/geoloc-members-json.sh index 8978a74..e15ad0d 100755 --- a/scripts/geoloc-members-json.sh +++ b/scripts/geoloc-members-json.sh @@ -4,6 +4,7 @@ GPATH="$( cd "$(dirname "$0")" ; pwd -P )/.." [[ ! -f $GPATH/.env ]] && cp $GPATH/.env.example $GPATH/.env source $GPATH/.env +timeout=5 FILE="/tmp/geoloc-members.json" FINAL_LOCATION="$WEBPATH/data/geoloc-members.json" @@ -22,7 +23,7 @@ for i in $DATA_MBR; do IFS=$oldIFS pubkey=$(echo $i | awk '{ print $1 }') userId=\"$(echo $i | awk '{ print $2 }')\" - result=$($JAKLIS get -p $pubkey) + result=$(timeout $timeout $JAKLIS get -p $pubkey) geoPoint=$(echo "$result" | jq .geoPoint 2>/dev/null) if [[ "$geoPoint" == "null" || "$result" == "Profile vide" ]]; then @@ -43,7 +44,7 @@ for i in $DATA_NONMBR; do IFS=$oldIFS pubkey=$(echo $i | awk '{ print $1 }') userId=\"$(echo $i | awk '{ print $2 }')\" - result=$($JAKLIS get -p $pubkey) + result=$(timeout $timeout $JAKLIS get -p $pubkey) geoPoint=$(echo "$result" | jq .geoPoint 2>/dev/null) if [[ "$geoPoint" == "null" || "$result" == "Profile vide" ]]; then @@ -61,7 +62,7 @@ done for i in $DATA_LARF; do - result=$($JAKLIS get -p $i) + result=$(timeout $timeout $JAKLIS get -p $i) geoPoint=$(echo "$result" | jq .geoPoint 2>/dev/null) if [[ "$geoPoint" == "null" || "$result" == "Profile vide" ]]; then @@ -87,7 +88,7 @@ finalResult=$(cat $FILE | jq .) RESULT=$? if [ $RESULT -eq 0 ]; then - echo "$finalResult" > $FINAL_LOCATION_ALT + echo "$finalResult" > $FINAL_LOCATION else echo "Failed" >> $FILE fi