w4it-for-port-open: Find tcptraceroute with which.

This commit is contained in:
Ole Tange 2013-07-02 13:27:11 +02:00
parent a62c84bc83
commit f679d50a42

View file

@ -3,6 +3,8 @@
HOST=$1 HOST=$1
PORT=$2 PORT=$2
TCPTRACEROUTE=$( which tcptraceroute )
usage () { usage () {
echo "Usage:" echo "Usage:"
echo " $0 host [port]" echo " $0 host [port]"
@ -28,7 +30,6 @@ print_up_but_port_closed () {
fi fi
} }
port_is_open () { port_is_open () {
# If tcptraceroute stops working use: # If tcptraceroute stops working use:
# echo | nc -w 2 $HOST $PORT || failed # echo | nc -w 2 $HOST $PORT || failed
@ -51,6 +52,10 @@ fi
if [ -z "$PORT" ] ; then if [ -z "$PORT" ] ; then
PORT=22 PORT=22
fi fi
if [ -z "$TCPTRACEROUTE" ] ; then
echo "Error, 'tcptraceroute' not installed."
exit 2
fi
port_is_open port_is_open
while [ "$OPEN" = "no" ] ; do while [ "$OPEN" = "no" ] ; do