improve output reachable

This commit is contained in:
Jakobus Schürz 2020-10-06 14:32:25 +02:00
parent c2e4e8ed7c
commit f872ef8f33

View file

@ -702,7 +702,7 @@ reachable () {
logwarn "not resolvable -> exit" logwarn "not resolvable -> exit"
return 1 return 1
else else
logwarn $IP loginfo $IP
fi fi
local PORT=${2:-22} local PORT=${2:-22}
local SEC=${3:-1} local SEC=${3:-1}
@ -710,7 +710,7 @@ reachable () {
local i local i
loginfo -n "Try to connect to ${SERVER} (${IP}):${PORT} " >&2 loginfo -n "Try to connect to ${SERVER} (${IP}):${PORT} " >&2
for i in $(seq 1 $SEC); do for i in $(seq 1 $SEC); do
loginfo -n "." >&2 logdebug -n "." >&2
if reachable-default ${IP} ${PORT} 2>/dev/null; then if reachable-default ${IP} ${PORT} 2>/dev/null; then
res=0 res=0
break break
@ -720,7 +720,7 @@ reachable () {
[ ${SEC} -gt 1 -a $i -lt ${SEC} ] && sleep 1 [ ${SEC} -gt 1 -a $i -lt ${SEC} ] && sleep 1
done done
[ ${res} -gt 0 ] && loginfo -n " not reachable" >&2 || loginfo -n " success" >&2; [ ${res} -gt 0 ] && loginfo " not reachable" >&2 || loginfo " success" >&2;
EXIT EXIT
return $res return $res