Compare commits
No commits in common. "8df59231a530cf96e27bd5d8e0e3eb71255b8456" and "c29f1dc07e0a0dbe388d25d349c0902de6bab7a0" have entirely different histories.
8df59231a5
...
c29f1dc07e
4 changed files with 9 additions and 8 deletions
|
@ -45,8 +45,8 @@ json="{\"transaction_uuid\":\"$uuid\",\"controller_id\":\"$name\",\"timestamp\":
|
||||||
touch $install_dir/lock
|
touch $install_dir/lock
|
||||||
file=$(date +%Y%m%d%H%M%S)-$(uuidgen)
|
file=$(date +%Y%m%d%H%M%S)-$(uuidgen)
|
||||||
for ((i=1 ; i <=3 ; i++));do
|
for ((i=1 ; i <=3 ; i++));do
|
||||||
if echo $json | $json_linter >/dev/null 2>&1 ;then
|
if echo $json | jsonlint-php 2> /dev/null;then
|
||||||
echo $json > $install_dir/stack/$file && rm $install_dir/lock && echo $((counter+1)) > $install_dir/counter && break
|
echo $json > /opt/nodemecu/stack/$file && rm /opt/nodemecu/lock && echo $((counter+1)) > $install_dir/counter && break
|
||||||
else
|
else
|
||||||
echo "$(date +%Y-%m-%d-%H:%M:%S) - No se pudo obtener información." >> $install_dir/errors.log && sleep 1
|
echo "$(date +%Y-%m-%d-%H:%M:%S) - No se pudo obtener información." >> $install_dir/errors.log && sleep 1
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
get_stack () {
|
get_stack () {
|
||||||
if [[ ! -z $1 && $1 == "wc" ]];then
|
if [[ ! -z $1 && $1 == "wc" ]];then
|
||||||
ls $install_dir/stack | wc -l
|
ls /opt/nodemecu/stack | wc -l
|
||||||
else
|
else
|
||||||
ls $install_dir/stack | tail -1
|
ls /opt/nodemecu/stack | tail -1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ url=https://ectomobile.sutty.nl/transactions
|
||||||
name=
|
name=
|
||||||
interval=
|
interval=
|
||||||
mode=test
|
mode=test
|
||||||
json_linter=jsonlint-php
|
|
||||||
|
|
||||||
|
|
||||||
# AJUSTES GENERALES
|
# AJUSTES GENERALES
|
||||||
|
|
|
@ -3,13 +3,12 @@
|
||||||
source /etc/nodemecu.conf
|
source /etc/nodemecu.conf
|
||||||
source $install_dir/functions
|
source $install_dir/functions
|
||||||
|
|
||||||
# No expandir directorios vacíos
|
|
||||||
shopt -s nullglob
|
|
||||||
|
|
||||||
# Revisando stack
|
# Revisando stack
|
||||||
|
|
||||||
for filename in $install_dir/stack/*;do
|
for filename in $install_dir/stack/*;do
|
||||||
$json_linter $filename >/dev/null 2>&1 || mv -v $filename $corrupt
|
test "$filename" = "$install_dir/stack/\*" || break
|
||||||
|
jq $filename >/dev/null 2>&1 || mv -v $filename $corrupt
|
||||||
done
|
done
|
||||||
|
|
||||||
while :;do
|
while :;do
|
||||||
|
@ -42,4 +41,7 @@ while :;do
|
||||||
echo $err_time - $local_transaction_uuid - server status: $server_error $srv_msg $curl_msg >> $log
|
echo $err_time - $local_transaction_uuid - server status: $server_error $srv_msg $curl_msg >> $log
|
||||||
rm $curl_err
|
rm $curl_err
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
exit
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue