Arreglos varios #6
1 changed files with 6 additions and 6 deletions
12
register.sh
12
register.sh
|
@ -25,23 +25,23 @@ while :;do
|
||||||
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"
|
file="$stack/$file"
|
||||||
local_transaction_uuid="$(echo "$file" | cut -d - -f 2-)"
|
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_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 [ "$local_transaction_uuid" = "$remote_response" ]; then
|
if [ "$local_transaction_uuid" = "$remote_response" ]; then
|
||||||
mv $file $historical
|
mv $file $historical
|
||||||
echo -e "$remote_response: \e[92mOK\e[0m"
|
echo -e "$remote_response: \e[92mOK\e[0m"
|
||||||
else
|
else
|
||||||
mv $file $failed
|
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
|
||||||
unset curl_msg
|
unset curl_msg
|
||||||
[ ! -z "$remote_response" ] && srv_msg="- $( echo $remote_response | grep -o '<body.*>.*</body>')"
|
[ ! -z "$remote_response" ] && srv_msg="- $( echo $remote_response | grep -o '<body.*>.*</body>')"
|
||||||
[ -s "$curl_err" ] && curl_msg="- $(<$curl_err)"
|
[ -s "$curl_err" ] && curl_msg="- $(<$curl_err)"
|
||||||
echo $(date +%Y-%m-%d-%H:%M:%S) - $local_transaction_uuid - server status: $server_error $srv_msg $curl_msg >> $log
|
echo $(date +%Y-%m-%d-%H:%M:%S) - $local_transaction_uuid - server status: $server_error $srv_msg $curl_msg >> $log
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue