change get IP from dig to getent
This commit is contained in:
parent
33662fa36b
commit
870209519c
1 changed files with 6 additions and 2 deletions
|
@ -608,7 +608,9 @@ reachable-default () {
|
||||||
reachableim () {
|
reachableim () {
|
||||||
|
|
||||||
local SERVER=$1
|
local SERVER=$1
|
||||||
local IP=$(dig +nocmd $SERVER a +noall +answer|tail -n 1 |awk '{print $5}')
|
# dig does not consult /etc/hosts, so use getent hosts instead
|
||||||
|
#local IP=$(dig +nocmd $SERVER a +noall +answer|tail -n 1 |awk '{print $5}')
|
||||||
|
local IP=$(getent ahosts $SERVER|awk '$0 ~ /STREAM/ {print $1}')
|
||||||
local PORT=${2:-22}
|
local PORT=${2:-22}
|
||||||
local SEC=${3:-1}
|
local SEC=${3:-1}
|
||||||
local res=1
|
local res=1
|
||||||
|
@ -631,7 +633,9 @@ reachableim () {
|
||||||
|
|
||||||
reachable () {
|
reachable () {
|
||||||
local SERVER=$1
|
local SERVER=$1
|
||||||
local IP=$(dig +nocmd $SERVER a +noall +answer|tail -n 1 |awk '{print $5}')
|
# dig does not consult /etc/hosts, so use getent hosts instead
|
||||||
|
#local IP=$(dig +nocmd $SERVER a +noall +answer|tail -n 1 |awk '{print $5}')
|
||||||
|
local IP=$(getent ahosts $SERVER|awk '$0 ~ /STREAM/ {print $1}')
|
||||||
local PORT=${2:-22}
|
local PORT=${2:-22}
|
||||||
local SEC=${3:-1}
|
local SEC=${3:-1}
|
||||||
local res=1
|
local res=1
|
||||||
|
|
Loading…
Reference in a new issue