From e7cf67478b2f3e4e6f775f4aabcb0586cabed846 Mon Sep 17 00:00:00 2001 From: linggao Date: Sat, 9 Feb 2008 00:45:50 +0000 Subject: [PATCH] pping changes the output text of fping from "is active/is unreachable" to ":ping/:noping" git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@434 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-client-2.0/bin/pping | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/xCAT-client-2.0/bin/pping b/xCAT-client-2.0/bin/pping index cd08ea034..d19946a05 100755 --- a/xCAT-client-2.0/bin/pping +++ b/xCAT-client-2.0/bin/pping @@ -21,7 +21,7 @@ my $interface; GetOptions("interface=s" => \$interface); my $xcathost='localhost:3001'; if ($ENV{XCATHOST}) { - $xcathost=$ENV{XCATHOST}; + $xcathost=$ENV{XCATHOST}; } unless (@ARGV) { @@ -74,6 +74,14 @@ if ($interface) { } } -exec "fping ".join(' ',@nodes). " 2> /dev/null"; - +#exec "fping ".join(' ',@nodes). " 2> /dev/null"; +open (FPING, "fping ".join(' ',@nodes). " 2> /dev/null|") or die("Cannot open fping pipe: $!"); +while () { + if ($_ =~ /is unreachable/) { + s/ is unreachable/: noping/; + } elsif ($_ =~ /is alive/) { + s/ is alive/: ping/; + } + print $_; +}