Compare commits

...

5 commits

Author SHA1 Message Date
f
8df59231a5 poder configurar el linter de json 2022-03-03 14:28:11 -03:00
f
ee4dc72a0a no hardcodear el directorio de instalación 2022-03-03 14:25:27 -03:00
f
0f0a743123 no expandir directorios vacíos 2022-03-03 14:25:16 -03:00
f
3bd1b4cf48 cambia local 2022-03-03 14:18:32 -03:00
f
253992520b no hace falta salir 2022-03-03 14:17:10 -03:00
4 changed files with 8 additions and 9 deletions

View file

@ -45,8 +45,8 @@ json="{\"transaction_uuid\":\"$uuid\",\"controller_id\":\"$name\",\"timestamp\":
touch $install_dir/lock
file=$(date +%Y%m%d%H%M%S)-$(uuidgen)
for ((i=1 ; i <=3 ; i++));do
if echo $json | jsonlint-php 2> /dev/null;then
echo $json > /opt/nodemecu/stack/$file && rm /opt/nodemecu/lock && echo $((counter+1)) > $install_dir/counter && break
if echo $json | $json_linter >/dev/null 2>&1 ;then
echo $json > $install_dir/stack/$file && rm $install_dir/lock && echo $((counter+1)) > $install_dir/counter && break
else
echo "$(date +%Y-%m-%d-%H:%M:%S) - No se pudo obtener información." >> $install_dir/errors.log && sleep 1
fi

View file

@ -1,8 +1,8 @@
get_stack () {
if [[ ! -z $1 && $1 == "wc" ]];then
ls /opt/nodemecu/stack | wc -l
ls $install_dir/stack | wc -l
else
ls /opt/nodemecu/stack | tail -1
ls $install_dir/stack | tail -1
fi
}

View file

@ -2,6 +2,7 @@ url=https://ectomobile.sutty.nl/transactions
name=
interval=
mode=test
json_linter=jsonlint-php
# AJUSTES GENERALES

View file

@ -3,12 +3,13 @@
source /etc/nodemecu.conf
source $install_dir/functions
# No expandir directorios vacíos
shopt -s nullglob
# Revisando stack
for filename in $install_dir/stack/*;do
test "$filename" = "$install_dir/stack/\*" || break
jq $filename >/dev/null 2>&1 || mv -v $filename $corrupt
$json_linter $filename >/dev/null 2>&1 || mv -v $filename $corrupt
done
while :;do
@ -41,7 +42,4 @@ while :;do
echo $err_time - $local_transaction_uuid - server status: $server_error $srv_msg $curl_msg >> $log
rm $curl_err
fi
done
exit