Arreglos varios #6
3 changed files with 10 additions and 5 deletions
|
@ -18,6 +18,7 @@ sudo mkdir -vp $install_dir/archives/logs
|
||||||
sudo mkdir $historical
|
sudo mkdir $historical
|
||||||
sudo mkdir $stack
|
sudo mkdir $stack
|
||||||
sudo mkdir $corrupt
|
sudo mkdir $corrupt
|
||||||
|
sudo mkdir $failed
|
||||||
echo ""
|
echo ""
|
||||||
sudo cp -vr $files $install_dir
|
sudo cp -vr $files $install_dir
|
||||||
sudo cp -v $config /etc/nodemecu.conf
|
sudo cp -v $config /etc/nodemecu.conf
|
||||||
|
|
|
@ -15,3 +15,4 @@ stack=$install_dir/stack
|
||||||
historical=$install_dir/historical
|
historical=$install_dir/historical
|
||||||
log=$install_dir/errors.log
|
log=$install_dir/errors.log
|
||||||
corrupt=$install_dir/corrupt
|
corrupt=$install_dir/corrupt
|
||||||
|
failed=$install_dir/failed
|
||||||
|
|
13
register.sh
13
register.sh
|
@ -24,15 +24,18 @@ while :;do
|
||||||
if [ $test_url -ne 200 ];then
|
if [ $test_url -ne 200 ];then
|
||||||
echo "$(date +%Y-%m-%d-%H:%M:%S) - $url - $test_url" >> $log && sleep 300 && continue
|
echo "$(date +%Y-%m-%d-%H:%M:%S) - $url - $test_url" >> $log && sleep 300 && continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
file="$stack/$file"
|
||||||
|
local_transaction_uuid="$(echo "$file" | cut -d - -f 2-)"
|
||||||
|
remote_transaction=$(curl -s --connect-timeout 1 --show-error -w "~%{http_code}" -X POST -H "Content-Type: application/json" -d @$file $url 2> $curl_err)
|
||||||
remote_response="$(echo $remote_transaction | cut -d '~' -f 1)"
|
remote_response="$(echo $remote_transaction | cut -d '~' -f 1)"
|
||||||
server_error="$(echo $remote_transaction | cut -d '~' -f 2)"
|
server_error="$(echo $remote_transaction | cut -d '~' -f 2)"
|
||||||
if [ ${#remote_response} -eq 36 ];then
|
|
||||||
|
|
||||||
if [ $local_transaction_uuid == $remote_response ]; then
|
if [ "$local_transaction_uuid" = "$remote_response" ]; then
|
||||||
mv $stack/$file $historical
|
mv $file $historical
|
||||||
echo -e "$remote_response: \e[92mOK\e[0m"
|
echo -e "$remote_response: \e[92mOK\e[0m"
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
|
mv $file $failed
|
||||||
echo -e "$local_transaction_uuid: \e[91mFAIL\e[0m"
|
echo -e "$local_transaction_uuid: \e[91mFAIL\e[0m"
|
||||||
# errores
|
# errores
|
||||||
unset srv_msg
|
unset srv_msg
|
||||||
|
|
Loading…
Reference in a new issue