grml-network: fix nmap usage for recent nmap versions
authorMichael Prokop <mika@grml.org>
Thu, 8 May 2014 09:41:56 +0000 (11:41 +0200)
committerMichael Prokop <mika@grml.org>
Thu, 8 May 2014 09:41:56 +0000 (11:41 +0200)
The --max_rtt_timeout setting wants us to use 4000ms instead
of 4000:

| % nmap -sP --host_timeout 4000 --max_rtt_timeout 4000 192.168.88.1                                                     :(
| Since April 2010, the default unit for --max-rtt-timeout is seconds, so your time of "4000" is 4000 seconds. Use "4000ms" for 4000 milliseconds.
| QUITTING!

This finally reports correct online/offline status again.

sbin/grml-network

index 4905f39..7f47cd4 100755 (executable)
@@ -55,7 +55,7 @@ main(){
     STATUS=""
     GW="`echo $(route -n | awk '/^0\.0\.0\.0/{print $2}')`"
     GWDEV="`echo $(route -n | awk '/^0\.0\.0\.0/{print $NF}')`"
-    NMAP="$(nmap -sP --host_timeout 4000 --max_rtt_timeout 4000 $GW 2>/dev/null)"
+    NMAP="$(nmap -sP --host_timeout 4000 --max_rtt_timeout 4000ms $GW 2>/dev/null)"
 
     if [ "$?" = 0 ]; then
       echo "$NMAP" | grep -q "down" >/dev/null 2>&1 || STATUS="online"