added searching for port number in /etc/services for applications that do not have port number specified in monsetting table for appstatus monitoring

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5118 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
linggao 2010-02-02 17:58:28 +00:00
parent aa68229e33
commit 1a19bf0389

View File

@ -174,7 +174,18 @@ sub preprocess_request
#add port number in if nothing is specified
if (exists($default_ports{$app})) { $apps{$app}->{'port'} = $default_ports{$app}; }
else {
print "need to get the port number form /etc/services\n";
my $p=`grep "^$app" /etc/services`;
if ($? == 0) {
my @a_list=sort(split('\n', $p));
my @a_temp=split('/',$a_list[0]);
my @a=split(' ', $a_temp[0]);
$apps{$app}->{'port'}=$a[1];
} else {
my $rsp={};
$rsp->{data}->[0]= "Cannot find port number for application $app. Please either specify a port number or a command in monsetting table for $app.";;
xCAT::MsgUtils->message("I", $rsp, $cb);
return (0);
}
}
}