Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit f90b4a62 authored by Kevin Yung's avatar Kevin Yung
Browse files

Change comments in get_id_devices_change.sh to english

parent ba3b19ee
...@@ -11,17 +11,19 @@ ...@@ -11,17 +11,19 @@
# Bug: # Bug:
# ------------------------------------------------- # -------------------------------------------------
#!/bin/bash
TODAY="$(date +"%Y-%m-%d")" TODAY="$(date +"%Y-%m-%d")"
# DATA REPOSITORY # DATA REPOSITORY
DATA_DEV_FOLDER="data/devices/" DATA_DEV_FOLDER="data/devices/"
#On stock les ids des devices d'aujourd'hui #We store devices' ids of the present day
ids=$(jq --raw-output ".result[] | select(.!=null) | .devEUI" ${DATA_DEV_FOLDER}.devices.json) ids=$(jq --raw-output ".result[] | select(.!=null) | .devEUI" ${DATA_DEV_FOLDER}.devices.json)
id=($ids) id=($ids)
#On stock les dates de dernière activité des devices d'aujourd'hui #We store dates from the last activity of the devices from today
dates=$(jq --raw-output ".result[] | select(.!=null) | .lastSeenAt" ${DATA_DEV_FOLDER}.devices.json) dates=$(jq --raw-output ".result[] | select(.!=null) | .lastSeenAt" ${DATA_DEV_FOLDER}.devices.json)
date=() date=()
date=($dates) date=($dates)
...@@ -44,8 +46,7 @@ do ...@@ -44,8 +46,7 @@ do
fi fi
done done
#On stock les states des devices d'aujourd'hui dans un tableau en regardant la date #We store states from today devices in an array by looking at last activity dates
#de dernière activité des devices
for (( i=0; i<${#d[@]}; i++ )) for (( i=0; i<${#d[@]}; i++ ))
do do
if [[ "${d[$i]}" == "$TODAY" ]] if [[ "${d[$i]}" == "$TODAY" ]]
...@@ -58,7 +59,7 @@ done ...@@ -58,7 +59,7 @@ done
if [ -f "${DATA_DEV_FOLDER}.last_devices_states.json" ]; then if [ -f "${DATA_DEV_FOLDER}.last_devices_states.json" ]; then
#On stock les ids des devices d'hier #We store yesterday devices ids
ids_2=$(jq --raw-output ".result[] | .id" ${DATA_DEV_FOLDER}.last_devices_states.json) ids_2=$(jq --raw-output ".result[] | .id" ${DATA_DEV_FOLDER}.last_devices_states.json)
id_2=() id_2=()
i=0 i=0
...@@ -68,7 +69,7 @@ if [ -f "${DATA_DEV_FOLDER}.last_devices_states.json" ]; then ...@@ -68,7 +69,7 @@ if [ -f "${DATA_DEV_FOLDER}.last_devices_states.json" ]; then
i=$((i+1)) i=$((i+1))
done done
#On stock les states des devices d'hier #We store yesterday devices states
full_state=$(jq --raw-output ".result[] | .lastState" ${DATA_DEV_FOLDER}.last_devices_states.json) full_state=$(jq --raw-output ".result[] | .lastState" ${DATA_DEV_FOLDER}.last_devices_states.json)
states_2=() states_2=()
j=0 j=0
...@@ -79,7 +80,7 @@ if [ -f "${DATA_DEV_FOLDER}.last_devices_states.json" ]; then ...@@ -79,7 +80,7 @@ if [ -f "${DATA_DEV_FOLDER}.last_devices_states.json" ]; then
done done
fi fi
#On compare les states des devices d'aujourd'hui et hier #We compare today and yesterday devices states
for (( i=0; i<${#id[@]}; i++ )) for (( i=0; i<${#id[@]}; i++ ))
do do
for (( j=0; j<${#id_2[@]}; j++ )) for (( j=0; j<${#id_2[@]}; j++ ))
...@@ -109,7 +110,7 @@ do ...@@ -109,7 +110,7 @@ do
fi fi
done done
#On met à jour les states des devices pour le prochain jour #We update devices state for the next day
echo "{ echo "{
\"totalCount\": \"${#id[@]}\", \"totalCount\": \"${#id[@]}\",
\"result\": [" > ${DATA_DEV_FOLDER}.last_devices_states.json \"result\": [" > ${DATA_DEV_FOLDER}.last_devices_states.json
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment