# OCS.ctl: Defines Common Oracle Collaboration Suite Macros # $Id: OCS.ctl,v 1.3 2013/10/30 07:18:34 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/OFM/OCS.ctl,v 1.3 2013/10/30 07:18:34 RDA Exp $ # # Change History # 20130421 MSC Improve the validation. =head1 NAME OFM:OCS - Defines Common Oracle Collaboration Suite Macros =head1 DESCRIPTION This persistent submodule regroups macros that are common to several Oracle Collaboration Suite modules. The following macros are available: =cut # Make the module persistent and share macros keep $KEEP_BLOCK,@SHARE_MACROS var @SHARE_MACROS = ('get_log','get_last_log') =head2 S This macro collects the last lines of the log file. When you do not specify a number of lines, RDA collects the whole log file. =cut # Get the log file macro get_log {var ($dir,$nam,$lin) = @arg debug ' Inside get_log, looking for ',$nam,' in ',$dir import $TOP var $fil = catFile($dir,$nam) if ?testFile('f',$fil) {if $lin {write '---+ Last ',$lin,' Lines of ',encode($nam),' File' write '---## Information Taken from ',encode($fil) call writeTail($fil,$lin) } else {write '---+ Display of ',encode($nam),' File' write '---## Information Taken from ',encode($fil) call writeFile($fil) } write $TOP } } =head2 S This macro lists the directories present, lists the content of the most recent directory, and collects the log file from the most recent directory. =cut macro get_last_log {var ($dir,$age,$lin) = @arg debug ' Inside get_last_log, looking most recent log in ',$dir import $TOC,$TOP # Get the directory list var @dir = grepDir($dir,'^\d+$',concat('ptm',$age)) write '---+ Most Recent Directories' if !@dir {write 'No changes in ',encode($dir),' during ',$age,' last days' return } write 'In ',encode($dir),'%BR%Limited to ',$age,' last days' call statFile('b',@dir) write $TOP # Get the last directory content var $dir = $dir[0] write '---+ Last Directory Content' call statDir('n',$dir) write $TOP # Get the log file call get_log($dir,concat(basename($dir),'.log'),$lin) call get_log($dir,'text.log',$lin) } =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