probar la conexión sólo cuando hay un archivo para enviar

This commit is contained in:
f 2022-03-03 15:06:00 -03:00
parent 6105e5948e
commit 4411d7ee0c

View file

@ -16,15 +16,14 @@ while :;do
[ -f $install_dir/stop ] && break
[ -f $install_dir/lock ] && continue
file=$(get_stack)
[ -z $file ] && continue
ping -c 1 fsf.org > /dev/null 2>&1 || continue
test_url="$(curl -s -X POST -o /dev/null -w "%{http_code}" $url)"
if [ $test_url -ne 200 ];then
echo "$(date +%Y-%m-%d-%H:%M:%S) - $url - $test_url" >> $log && sleep 300 && continue
fi
file=$(get_stack)
[ -z $file ] && continue
local_transaction_uuid=$(jq -r '."transaction_uuid"' $stack/$file)
remote_transaction=$(curl -s --connect-timeout 0.9 --show-error -w "~%{http_code}" -X POST -H "Content-Type: application/json" -d @$stack/$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