# S000INI.def: Initialises the Data Collection # $Id: S000INI.def,v 1.27 2008/02/25 17:32:55 mschenke Exp $ # ARCS: $Header: /home/cvs/repository/RDA_4/src/scripting/lib/modules/S000INI.def,v 1.27 2008/02/25 17:32:55 mschenke Exp $ # # Change History # 20080225 MSC Change the copyright notice. =head1 NAME S000INI - Performs Data Collection Initialization =cut var $SEP = repeat('-',79) echo $SEP echo 'RDA Data Collection Started ',localtime('%d-%b-%Y %X') echo $SEP echo tput('bold'),'Processing Initialization module ...',tput('off') # Load the common macros before calling any other libraries run library() =head1 DESCRIPTION This module does the following: Performs operating system specific initialization. =cut run &{check(getOsName(),'aix', 'OSaix',\ 'darwin', 'OSdarwin',\ 'dec_osf', 'OSosf',\ 'dynixptx', 'OSptx',\ 'hpux', 'OShpux',\ 'linux', 'OSlinux',\ 'solaris', 'OSsunos',\ cond(isWindows(), 'OSwin32',\ isUnix(), 'OSunix',\ isVms(), 'OSvms'))}('INI') =pod When required for batch execution (for example, by cron jobs), defines login information to run data collection. =cut debug ' Inside the initialization module, setting logins' # Get the current login var $log = setSqlLogin() # Define the SQL logins loop $key (grepSetting('^SQL_PASSWORD_')) {if match($key,'^SQL_PASSWORD__([\+\w]+)__(.*)$') {var ($sid,$usr) = (last) var $sid = replace($sid,'plus','+',true) } else var ($usr,$sid) = (substr($key,13)) call setSqlLogin($usr,unpack('u',getSetting($key)),$sid) } loop $key (grepSetting('^SQL_PASS_\d+$')) {var ($usr,$sid) = split('\@',getSetting(replace($key,'_PASS_','_USER_')),2) call setSqlLogin($usr,unpack('u',getSetting($key)),$sid) } # Restore the current login call setSqlLogin($log) =pod Determines if output files can be produced. =cut debug ' Inside the initialization module, testing the report directory' if testOutput() die(last) =pod Determines if a database connection can be made. RDA performs this test only when the S200DB module has been configured. When a problem is detected, all SQL requests are disabled, but the other data collections are still performed. =cut if getSetting('DATABASE_INSTALLED') {debug ' Inside the initialization module, testing the database connection' macro check_sqlplus {var $cmd = getSetting('SQL_COMMAND','sqlplus') if or(isVms(),isAbsolute($cmd)) return testCommand(concat($cmd,' -V')) return findCommand($cmd) } if !check_sqlplus() {call setSqlFailure() call displayText('No sqlplus',true) } elsif testSql() {echo getSqlMessage() call displayText('No connection',true) if testSql() {echo tput('reverse'),last,tput('off') var $msg = getSqlMessage() call log('RDA','S000INI','DB',$msg) echo $msg call setSqlSid('') } else echo ' Database is now running.' } } =head1 SEE ALSO See also L, L, L, L, L, L, L, L, L, L. =head1 COPYRIGHT NOTICE Copyright (c) 2002-2008, Oracle. All rights reserved. =head1 TRADEMARK NOTICE Oracle, JD Edwards, PeopleSoft, and Siebel are registered trademarks of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. =cut