Add timestamp to json; change JSON format to do it.
This commit is contained in:
parent
e671679932
commit
92ae59a361
|
@ -7,14 +7,13 @@ source $GPATH/.env
|
||||||
|
|
||||||
FILE="/tmp/geoloc-members.json"
|
FILE="/tmp/geoloc-members.json"
|
||||||
FINAL_LOCATION="$WEBPATH/data/geoloc-members.json"
|
FINAL_LOCATION="$WEBPATH/data/geoloc-members.json"
|
||||||
|
FINAL_LOCATION_ALT="$WEBPATH/data/geoloc-members-alt.json"
|
||||||
|
|
||||||
DATA_MBR=$($JAKLIS listWallets --brut --mbr)
|
DATA_MBR=$($JAKLIS listWallets --brut --mbr)
|
||||||
DATA_NONMBR=$($JAKLIS listWallets --brut --non_mbr)
|
DATA_NONMBR=$($JAKLIS listWallets --brut --non_mbr)
|
||||||
DATA_LARF=$($JAKLIS listWallets --brut --larf)
|
DATA_LARF=$($JAKLIS listWallets --brut --larf)
|
||||||
|
|
||||||
echo "$DATA_LARF" > /tmp/tatata
|
echo "[{\"wallets\":[" > $FILE
|
||||||
|
|
||||||
echo "[" > $FILE
|
|
||||||
|
|
||||||
oldIFS=$IFS;
|
oldIFS=$IFS;
|
||||||
IFS=$'\n';
|
IFS=$'\n';
|
||||||
|
@ -34,6 +33,8 @@ for i in $DATA_MBR; do
|
||||||
resultWithMbr=$(echo "$result" | sed "s/\"geoPoint\": {/$userIdFormat $isMbr \"geoPoint\": {/g")
|
resultWithMbr=$(echo "$result" | sed "s/\"geoPoint\": {/$userIdFormat $isMbr \"geoPoint\": {/g")
|
||||||
echo "$resultWithMbr," >> $FILE
|
echo "$resultWithMbr," >> $FILE
|
||||||
fi
|
fi
|
||||||
|
[[ $DEBUG ]] && echo "$j - $i"
|
||||||
|
((j++))
|
||||||
done
|
done
|
||||||
|
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
|
@ -52,6 +53,8 @@ for i in $DATA_NONMBR; do
|
||||||
resultWithMbr=$(echo "$result" | sed "s/\"geoPoint\": {/$userIdFormat $isMbr \"geoPoint\": {/g")
|
resultWithMbr=$(echo "$result" | sed "s/\"geoPoint\": {/$userIdFormat $isMbr \"geoPoint\": {/g")
|
||||||
echo "$resultWithMbr," >> $FILE
|
echo "$resultWithMbr," >> $FILE
|
||||||
fi
|
fi
|
||||||
|
[[ $DEBUG ]] && echo "$j - $i"
|
||||||
|
((j++))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,17 +69,22 @@ for i in $DATA_LARF; do
|
||||||
resultWithMbr=$(echo "$result" | sed "s/\"geoPoint\": {/$isMbr \"geoPoint\": {/g")
|
resultWithMbr=$(echo "$result" | sed "s/\"geoPoint\": {/$isMbr \"geoPoint\": {/g")
|
||||||
echo "$resultWithMbr," >> $FILE
|
echo "$resultWithMbr," >> $FILE
|
||||||
fi
|
fi
|
||||||
|
[[ $DEBUG ]] && echo "$j - $i"
|
||||||
|
((j++))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
nowD=$(date +"%s")
|
||||||
|
|
||||||
sed -i '$ d' $FILE
|
sed -i '$ d' $FILE
|
||||||
echo "}" >> $FILE
|
echo "}]},{" >> $FILE
|
||||||
echo "]" >> $FILE
|
echo "\"time\": $nowD" >> $FILE
|
||||||
|
echo "}]" >> $FILE
|
||||||
|
|
||||||
finalResult=$(cat $FILE | jq .)
|
finalResult=$(cat $FILE | jq .)
|
||||||
RESULT=$?
|
RESULT=$?
|
||||||
|
|
||||||
if [ $RESULT -eq 0 ]; then
|
if [ $RESULT -eq 0 ]; then
|
||||||
echo "$finalResult" > $FINAL_LOCATION
|
echo "$finalResult" > $FINAL_LOCATION_ALT
|
||||||
else
|
else
|
||||||
echo "Failed" >> $FILE
|
echo "Failed" >> $FILE
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue