Arreglos varios #6

Open
fauno wants to merge 21 commits from arreglos into master
3 changed files with 10 additions and 5 deletions
Showing only changes of commit 2feee6f70b - Show all commits

View file

@ -18,6 +18,7 @@ sudo mkdir -vp $install_dir/archives/logs
sudo mkdir $historical
sudo mkdir $stack
sudo mkdir $corrupt
sudo mkdir $failed
echo ""
sudo cp -vr $files $install_dir
sudo cp -v $config /etc/nodemecu.conf

View file

@ -15,3 +15,4 @@ stack=$install_dir/stack
historical=$install_dir/historical
log=$install_dir/errors.log
corrupt=$install_dir/corrupt
failed=$install_dir/failed

View file

@ -24,15 +24,18 @@ while :;do
if [ $test_url -ne 200 ];then
echo "$(date +%Y-%m-%d-%H:%M:%S) - $url - $test_url" >> $log && sleep 300 && continue
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)"
server_error="$(echo $remote_transaction | cut -d '~' -f 2)"
if [ ${#remote_response} -eq 36 ];then
if [ $local_transaction_uuid == $remote_response ]; then
mv $stack/$file $historical
echo -e "$remote_response: \e[92mOK\e[0m"
fi
if [ "$local_transaction_uuid" = "$remote_response" ]; then
mv $file $historical
echo -e "$remote_response: \e[92mOK\e[0m"
else
mv $file $failed
echo -e "$local_transaction_uuid: \e[91mFAIL\e[0m"
# errores
unset srv_msg