From 8df59231a530cf96e27bd5d8e0e3eb71255b8456 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 3 Mar 2022 14:28:11 -0300 Subject: [PATCH] poder configurar el linter de json --- data_gen.sh | 4 ++-- nodemecu.conf.sample | 1 + register.sh | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/data_gen.sh b/data_gen.sh index e051db5..a318bfa 100755 --- a/data_gen.sh +++ b/data_gen.sh @@ -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 diff --git a/nodemecu.conf.sample b/nodemecu.conf.sample index bfb5883..aadd101 100644 --- a/nodemecu.conf.sample +++ b/nodemecu.conf.sample @@ -2,6 +2,7 @@ url=https://ectomobile.sutty.nl/transactions name= interval= mode=test +json_linter=jsonlint-php # AJUSTES GENERALES diff --git a/register.sh b/register.sh index f207c78..66c93e5 100755 --- a/register.sh +++ b/register.sh @@ -9,7 +9,7 @@ shopt -s nullglob # Revisando stack for filename in $install_dir/stack/*;do - jq $filename >/dev/null 2>&1 || mv -v $filename $corrupt + $json_linter $filename >/dev/null 2>&1 || mv -v $filename $corrupt done while :;do