projects
/
grml-network.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cb456de
)
grml-network: nmap reports "0 hosts up" instead of "down" nowadays
author
Michael Prokop
<mika@grml.org>
Thu, 8 May 2014 12:25:26 +0000
(14:25 +0200)
committer
Michael Prokop
<mika@grml.org>
Thu, 8 May 2014 12:25:26 +0000
(14:25 +0200)
sbin/grml-network
patch
|
blob
|
history
diff --git
a/sbin/grml-network
b/sbin/grml-network
index
7f47cd4
..
f1c8e7a
100755
(executable)
--- a/
sbin/grml-network
+++ b/
sbin/grml-network
@@
-53,12
+53,14
@@
main(){
if [ -z "$NOCHECK" -a -x /usr/bin/nmap ] ; then
gauge "Checking network status..." &
STATUS=""
if [ -z "$NOCHECK" -a -x /usr/bin/nmap ] ; then
gauge "Checking network status..." &
STATUS=""
- GW="
`echo $(route -n | awk '/^0\.0\.0\.0/{print $2}')`
"
- GWDEV="
`echo $(route -n | awk '/^0\.0\.0\.0/{print $NF}')`
"
+ 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 4000ms $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"
+ if [ $? -eq 0 ]; then
+ if ! echo "$NMAP" | grep -q '0 hosts up' ; then
+ STATUS="Online"
+ fi
fi
killgauge
fi
killgauge