add errorcode when nc not found
This commit is contained in:
parent
b6db22c888
commit
1531ccd9ae
1 changed files with 7 additions and 2 deletions
|
@ -678,8 +678,12 @@ reachable-default () {
|
||||||
local SERVER=$1
|
local SERVER=$1
|
||||||
local PORT=${2:-22}
|
local PORT=${2:-22}
|
||||||
local res=3
|
local res=3
|
||||||
if nc -w 2 -z $SERVER $PORT 2>/dev/null; then
|
if which nc >/dev/null; then
|
||||||
res=0
|
if nc -w 2 -z $SERVER $PORT 2>/dev/null; then
|
||||||
|
res=0
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
res=2
|
||||||
fi
|
fi
|
||||||
return $res
|
return $res
|
||||||
}
|
}
|
||||||
|
@ -688,6 +692,7 @@ reachable () {
|
||||||
ENTRY
|
ENTRY
|
||||||
# returncodes:
|
# returncodes:
|
||||||
# 1: servername not resolveable
|
# 1: servername not resolveable
|
||||||
|
# 2: command nc not found
|
||||||
# 3: server:port not reachable
|
# 3: server:port not reachable
|
||||||
# 999999: something went wrong
|
# 999999: something went wrong
|
||||||
# 0: server was resolve- and reachable
|
# 0: server was resolve- and reachable
|
||||||
|
|
Loading…
Reference in a new issue