#!/usr/bin/perl # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # # # Licensed Materials - Property of IBM # # (C) COPYRIGHT International Business Machines Corp. 2001,2019 # All Rights Reserved # # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # # IBM_PROLOG_END_TAG # # sccsid = "@(#)13 1.4 src/rsct/cfg_access/cfgmgr/ct_read_machines_lst.perl, cfg.access, rsct_rady, rady2035a 11/12/15 16:43:40" # # Usage: ct_read_machines_lst [-l] # -l for the local data access # use Getopt::Std; my %opts = (); &getopts(':l',\%opts); my $filename=""; # Get the arguments... if ($#ARGV >= 0) { $filename = shift @ARGV; # user specified resource } else { # no file name print_errmsg("EMSG101 $progname"); exit(1); } # return codes: # 0 if successful # 1 if there is an error # 2 if not supported $RSCTBIN="/opt/rsct/bin"; $CLSTNAME = `$RSCTBIN/ct_clusterinfo -c`; chomp($CLSTNAME); if( !defined($CLSTNAME) || $CLSTNAME eq "" ) { # No cluster name found. &print_errmsg("EMSG105 $progname $CLSTNAME"); exit(2); # not-supported } $CFG_MACHINE_LST="/var/ct/$CLSTNAME/cfg/machine.lst"; if( ! -e $CFG_MACHINE_LST ) { # Error on opening $CFG_MACHINE_LST print_errmsg("EMSG108 $progname $CFG_MACHINE_LST"); exit(2); # not-supported } `cp $CFG_MACHINE_LST $filename`; exit 0; # success #-------- functions ----------------------------------- # print_dbgmsg(list) sub print_dbgmsg { my @args = @_; if(!defined($ccal_log_inited)) { my $outfile = $ENV{"HA_CCAL_LOG"}; $ccal_log_inited = 0; if(defined($outfile) && open(LOGOUT, ">>$outfile")) { $ccal_log_inited = 1; select LOGOUT; $| = 1; # unbuffered select STDOUT; } } if($ccal_log_inited) { my $dstr = scalar(localtime); my $msg = "$dstr $progname: " . join(" ", @args); print LOGOUT $msg, "\n" ; } } sub print_errmsg { $msgcmd = "$RSCTBIN/hadspmsg cfgaccess ha_com.cat ". join(" ",@_); system($msgcmd); } #-----------------------------------------------------