# LDcrs.ctl: Collects CRS diagnostic collection tool results # $Id: LDcrs.ctl,v 1.7 2015/08/21 15:34:34 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/DB/LDcrs.ctl,v 1.7 2015/08/21 15:34:34 RDA Exp $ # # Change History # 20150821 MSC Improve time consistency. =head1 NAME DB:LDcrs - Collects CRS Diagnostic Collection Tool Results =head1 DESCRIPTION =head2 crs_diag_tool - CRS Diagnostic Collection Tool This module executes the Cluster Ready Services (CRS) diagnostic collection tool and collects the produced files. =cut debug ' Inside LOAD module, running CRS diagnostic collection tool' report crs_diag_tool # Remove old reports var $abr = setAbbr('DB_CRS_') call purge('E','.',0,0,true) var $abr = setAbbr($abr) # Check if CRS collection is disabled if !${MOD.DB.CRS.B_LOAD} return # Check if Perl is available var $prl = ${RDA.T_PERL} if !$prl return # Initialization var $ORACLE_HOME = ${ORACLE_HOME:getEnv('ORACLE_HOME','')} # Determine CRS_HOME var $CRS_HOME = ${SET.DB.CRS.D_CRS_HOME} if !?$CRS_HOME run DB:CRSinit(\$CRS_HOME) if !?$CRS_HOME = testDir('d',$CRS_HOME) return # Run diacollection.pl var $fil = catFile($CRS_HOME,'bin','diagcollection.pl') if ?testFile('fr',$fil) {var ($pgm,@opt) = (lastCommand()) if !isAbsolute($dir = ${OUT.E}) var $dir = getGroupDir('D_CWD',$dir) # Determine the command options if !or(isWindows(),isCygwin()) {if grepFile($fil,'\[--nocore\]','fi') {if !${MOD.DB.CRS.B_CORE} var @opt = ('--nocore') } elsif ${MOD.DB.CRS.B_CORE} var @opt = ('--core') if grepFile($fil,'\[--afterdate\]','fi') {if match(${MOD.DB.CRS.T_AFTER},'^([01]\d/[0-3]\d/\d{4})$') call push(@opt,'--afterdate',last) } } if grepFile($fil,'\[--crshome\]','fi') call push(@opt,'--crshome',$CRS_HOME) # Set the CRS environment var $bkp = setContext({'CRS_HOME' => $CRS_HOME,\ 'ORACLE_HOME' => $ORACLE_HOME}) # Generate the job and execute it if isWindows() {var $job = createTemp('CRS','.bat',true) call writeTemp('CRS','@echo off') call writeTemp('CRS','cd /d "',getNativePath($dir),'"') call writeTemp('CRS','"',$prl,'" ',$pgm,' --collect --crs ',join(' ',@opt)) } elsif isVms() {var $job = createTemp('CRS','.com',true) call writeTemp('CRS','$ SET DEFAULT ',$dir) call writeTemp('CRS',join(' ','$','perl',$pgm,'--collect','--crs',@opt)) } else {var $job = createTemp('CRS','.sh',true) call writeTemp('CRS','cd "',$dir,'"') call writeTemp('CRS',join(' ',quote($prl),$pgm,'--collect','--crs',@opt)) } call closeTemp('CRS') call command(quote($job)) call unlinkTemp('CRS') # Restore the previous environment call restoreContext($bkp) # Rename the produced files and generate the report prefix {write '---+ Cluster Ready Services (CRS) Diagnostic Collection Tool Results' write '|*File Name*|*Last Modified Date*| *Size*|' } loop $src (grepDir($dir,'^(core|crs|ocr|ora)Data.*\.(gz|zip)$','in')) {var ($nam,$ext) = match($src,'^(core|crs|ocr|ora)Data.*\.(gz|zip)$','i') var $dst = concat($abr,$nam,'.',$ext) if transfer($dir,$src,$dir,$dst) {var $fil = catFile($dir,$dst) write '|[[extern/',$dst,'][_blank][',encode($src),']]|',\ getLastModify($fil,''),'| ',getSize($fil),'|' } } if isCreated(true) {write ' * Links point to files that have been collected in their original \ format. Opening them directly in your browser can present risks. \ To prevent them, access the file outside the browser or use \ the link to save them and use an adequate viewer.' toc '2:[[',getFile(),'][rda_report][CRS Diagnostic Collection Tool]]' } } =head1 SEE ALSO L =head1 COPYRIGHT NOTICE Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. =head1 TRADEMARK NOTICE Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. =cut