#!/usr/local/bin/perl
# 
# $Header: getNodeName.pl 15-jul-2005.14:35:29 ysun Exp $
#
# getNodeName.pl
# 
# Copyright (c) 2005, Oracle. All rights reserved.  
#
#    NAME
#      getNodeName.pl - <one-line expansion of the name>
#
#    DESCRIPTION
#      <short description of component this file declares/defines>
#
#    NOTES
#      <other useful comments, qualifications, etc.>
#
#    MODIFIED   (MM/DD/YY)
#    ysun        07/15/05 - update olsnodes -l
#    hying       01/10/05 - hying_crs_alertlog
#    hying       01/07/05 - Creation
# 
require "emd_common.pl";

my $crs_home = shift(@ARGV); # CRSHome

my $cmd;

if ($crs_home eq "")
{
  $cmd = "$ENV{EMDROOT}/bin/lsnodes -l";
}
else
{
  $cmd = "$crs_home/bin/olsnodes -l";
}

#################################
# View testing required ENV
#$ENV{OCR_LOC} = "/etc/oracle/ocr.loc";
#$ENV{OCR_DEVELOPER_ENV}="true";
#$ENV{LD_LIBRARY_PATH} = "$crs_home/lib:$ENV{LD_LIBRARY_PATH}";
#################################

my $result;
chomp($result = `$cmd 2>&1`);
if ($?)
{
  EMD_PERL_ERROR("$cmd:  $? $! $result");
}
else
{
  printf "em_result=$result\n";
  EMD_PERL_DEBUG("NodeName: $result");
}
exit 0;

