From 965aeac359e5b7979ea09bfca9991aefe5e8090e Mon Sep 17 00:00:00 2001 From: Ricardo Morales Date: Mon, 9 Apr 2018 08:46:18 +0200 Subject: [PATCH 1/3] =?UTF-8?q?Se=20ha=20a=C3=B1adido=20un=20resultado=20g?= =?UTF-8?q?anador?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dnstest.sh | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/dnstest.sh b/dnstest.sh index 23082f9..73cbf05 100755 --- a/dnstest.sh +++ b/dnstest.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/bash command -v bc > /dev/null || { echo "bc was not found. Please install bc."; exit 1; } { command -v drill > /dev/null && dig=drill; } || { command -v dig > /dev/null && dig=dig; } || { echo "dig was not found. Please install dnsutils."; exit 1; } @@ -27,6 +27,7 @@ DOMAINS2TEST="www.google.com amazon.com facebook.com www.youtube.com www.reddit. totaldomains=0 +result=2000000 printf "%-18s" "" for d in $DOMAINS2TEST; do totaldomains=$((totaldomains + 1)) @@ -45,11 +46,11 @@ for p in $NAMESERVERS $PROVIDERS; do for d in $DOMAINS2TEST; do ttime=`$dig +tries=1 +time=2 +stats @$pip $d |grep "Query time:" | cut -d : -f 2- | cut -d " " -f 2` if [ -z "$ttime" ]; then - #let's have time out be 1s = 1000ms - ttime=1000 + #let's have time out be 1s = 1000ms + ttime=1000 elif [ "x$ttime" = "x0" ]; then - ttime=1 - fi + ttime=1 + fi printf "%-8s" "$ttime ms" ftime=$((ftime + ttime)) @@ -57,7 +58,17 @@ for p in $NAMESERVERS $PROVIDERS; do avg=`bc -lq <<< "scale=2; $ftime/$totaldomains"` echo " $avg" + n1=$(echo $avg | cut -d"." -f 1) + n2=$(echo $avg | cut -d"." -f 2) + nf=$(echo "$n1$n2") + if [[ "$nf" -lt "$result" ]]; then + tiempo=$avg + result=$nf + ganador=$pname + fi done +echo "" +echo "## Ganador $ganador con un tiempo de $tiempo ##" exit 0; From 1344af7c93efb73ac4952000f6bb65e035c01839 Mon Sep 17 00:00:00 2001 From: Ricardo-AlterTable Date: Mon, 9 Apr 2018 08:55:38 +0200 Subject: [PATCH 2/3] =?UTF-8?q?Se=20ha=20a=C3=B1adido=20un=20resultado=20g?= =?UTF-8?q?anador?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dnstest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dnstest.sh b/dnstest.sh index 73cbf05..555f0df 100755 --- a/dnstest.sh +++ b/dnstest.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash command -v bc > /dev/null || { echo "bc was not found. Please install bc."; exit 1; } { command -v drill > /dev/null && dig=drill; } || { command -v dig > /dev/null && dig=dig; } || { echo "dig was not found. Please install dnsutils."; exit 1; } From 6ef0265f6db40038e93e9070cd7b055bedf77c3e Mon Sep 17 00:00:00 2001 From: Ricardo-AlterTable <38203120+Ricardo-AlterTable@users.noreply.github.com> Date: Fri, 25 May 2018 09:13:37 +0200 Subject: [PATCH 3/3] mod winner change a English winner --- dnstest.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dnstest.sh b/dnstest.sh index 555f0df..069d3be 100755 --- a/dnstest.sh +++ b/dnstest.sh @@ -62,13 +62,13 @@ for p in $NAMESERVERS $PROVIDERS; do n2=$(echo $avg | cut -d"." -f 2) nf=$(echo "$n1$n2") if [[ "$nf" -lt "$result" ]]; then - tiempo=$avg + timer=$avg result=$nf - ganador=$pname + winner=$pname fi done echo "" -echo "## Ganador $ganador con un tiempo de $tiempo ##" +echo "## The Winner is $winner with a time of $timer ##" exit 0;