Compare commits

...

3 commits

Author SHA1 Message Date
f
676b3628bb usar el log configurado 2022-03-03 14:33:24 -03:00
f
46541ea34d fracciones gringas 2022-03-03 14:31:55 -03:00
f
303e35b075 chequear si hay un lock primero 2022-03-03 14:29:58 -03:00
2 changed files with 5 additions and 4 deletions

View file

@ -48,6 +48,6 @@ json="{\"transaction_uuid\":\"$uuid\",\"controller_id\":\"$name\",\"timestamp\":
if echo $json | $json_linter >/dev/null 2>&1 ;then if echo $json | $json_linter >/dev/null 2>&1 ;then
echo $json > $install_dir/stack/$file && rm $install_dir/lock && echo $((counter+1)) > $install_dir/counter && break echo $json > $install_dir/stack/$file && rm $install_dir/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." >> $log && sleep 1
fi fi
done done

View file

@ -13,16 +13,17 @@ for filename in $install_dir/stack/*;do
done done
while :;do while :;do
[ -f $install_dir/lock ] && continue
ping -c 1 fsf.org > /dev/null 2>&1 || continue ping -c 1 fsf.org > /dev/null 2>&1 || continue
test_url="$(curl -s -X POST -o /dev/null -w "%{http_code}" $url)" test_url="$(curl -s -X POST -o /dev/null -w "%{http_code}" $url)"
if [ $test_url -eq 404 ];then if [ $test_url -eq 404 ];then
echo "$(date +%Y-%m-%d-%H:%M:%S) - $url - $test_url" >> $install_dir/errors.log && sleep 300 && continue echo "$(date +%Y-%m-%d-%H:%M:%S) - $url - $test_url" >> $log && sleep 300 && continue
fi fi
[ -f $install_dir/lock ] && continue
file=$(get_stack) file=$(get_stack)
[ -z $file ] && continue [ -z $file ] && continue
local_transaction_uuid=$(jq -r '."transaction_uuid"' $stack/$file) 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_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)" 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 [ ${#remote_response} -eq 36 ];then