From 44ca8dc1f3b4001734fd1fda018b79274226bb0e Mon Sep 17 00:00:00 2001 From: Kage1 <2062390+Kage1@users.noreply.github.com> Date: Mon, 29 Mar 2021 19:42:29 -0500 Subject: [PATCH] ${IPv} var interfering with timeout The ${IPv} var for the ping and port commands were after the wait parameter causing ping and nc to fail due to an invalid parameter. Moved the var to the beginning of the var string like the curl test. --- tinystatus | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tinystatus b/tinystatus index 8bec07e..7f82c08 100755 --- a/tinystatus +++ b/tinystatus @@ -29,11 +29,11 @@ check(){ http*) statuscode="$(curl -${IPv}sSkLo /dev/null -H "${useragent}" -m "${timeout}" -w "%{http_code}" "${host}" 2> "${tmp}/ko/${name}.error")";; ping*) - ping -W${IPv} "${timeout}" -c 1 "${host}" >/dev/null 2>&1 + ping -${IPv}W "${timeout}" -c 1 "${host}" >/dev/null 2>&1 statuscode=$? [ "${statuscode}" -ne "${expectedcode}" ] && echo 'Host unreachable' > "${tmp}/ko/${name}.error";; port*) - error="$(nc -w${IPv} "${timeout}" -zv ${host} 2>&1)" + error="$(nc -${IPv}w "${timeout}" -zv ${host} 2>&1)" statuscode=$? [ "${statuscode}" -ne "${expectedcode}" ] && echo "${error}" > "${tmp}/ko/${name}.error";; esac