#!/usr/bin/perl -w # # ############################################################### # Extra Modules should be declared here. # # All these modules MUST be found on the server attempting to # # call this script. # ############################################################### # use strict ; # Enforce private variables use lib '/home/rcruickshank/Perl/Perl_Modules' ; # Where ACC_Various lives use Cwd ; # Current Working Directory Module use Mail::Sender; # Email module # ############################################################### # ACC_Various is an in-house written Perl module and MUST be # # found in the current path if this script is to work. The # # use lib 'xxxxxxxxxx' command should be used to point to the # # path that this module can be found on if this is not the # # case. (Obviously this code MUST preceed the use ACC_Various # # call!) # ############################################################### # use ACC_Various qw(end_it mail mail_log update_report) ; # ############################################################### # HASH TABLES ############################################################### my %ISWTEST = ( "TERM" => "vt220", "EDITOR" => "vi", "SECTRAN_DIR" => "/home/interface/sectran", "ORACLE_SID" => "ISWTEST" , "ORACLE_HOME" => "/isw/tpp/oracle/test/8.1.7" , "LD_LIBRARY_PATH" => "/isw/tpp/oracle/test/8.1.7/lib:/usr/lib/:/usr/ucblib" , ) ; # my %ISWTEST_PATH = ( "TEST1" => "/usr/local/bin:", "TEST2" => "/usr/bin:", "TEST3" => "/usr/ucb:" , "TEST4" => "/etc:" , "TEST5" => "/isw/tpp/oracle/test/1.6.1/idst/bin:" , "TEST6" => "/isw/tpp/oracle/test/1.6.1/idst/forms60/mesg:", "TEST7" => "/isw/appwork/test/finance/guifmxs:" , "TEST8" => ".:" , "TEST9" => "/isw/tpp/oracle/test/8.1.7/bin:" , "TEST10" => "/isw/tpp/oracle/test/8.1.7/dbs", ) ; # my %ISWLIVE = ( "TERM" => "vt220", "EDITOR" => "vi", "SECTRAN_DIR" => "/home/interface/sectran", "ORACLE_SID" => "ISWLIVE" , "ORACLE_HOME" => "/isw/tpp/oracle/live/8.1.7" , "LD_LIBRARY_PATH" => "/isw/tpp/oracle/live/8.1.7/lib:/usr/lib/:/usr/ucblib" , ) ; # my %ISWLIVE_PATH = ( "LIVE1" => "/usr/local/bin:", "LIVE2" => "/usr/bin:", "LIVE3" => "/usr/ucb:" , "LIVE4" => "/etc:" , "LIVE5" => "/isw/tpp/oracle/live/1.6.1/ids/bin:" , "LIVE6" => "/isw/tpp/oracle/live/1.6.1/ids/forms60/mesg:", "LIVE7" => "/isw/appwork/live/finance/guifmxs:" , "LIVE8" => ".:" , "LIVE9" => "/isw/tpp/oracle/live/8.1.7/bin:" , "LIVE10" => "/isw/tpp/oracle/live/8.1.7/dbs", ) ; # my %ISWTEACH = ( "TERM" => "vt220", "EDITOR" => "vi", "SECTRAN_DIR" => "/home/interface/sectran", "ORACLE_SID" => "ISWTEACH" , "ORACLE_HOME" => "/isw/tpp/oracle/general/8.1.7" , "LD_LIBRARY_PATH" => "/isw/tpp/oracle/general/8.1.7/lib:/usr/lib/:/usr/ucblib" , ) ; # my %ISWTEACH_PATH = ( "LIVE1" => "/usr/local/bin:", "LIVE2" => "/usr/bin:", "LIVE3" => "/usr/ucb:" , "LIVE4" => "/etc:" , "LIVE5" => "/isw/tpp/oracle/general/1.6.1/ids/bin:" , "LIVE6" => "/isw/tpp/oracle/general/1.6.1/ids/forms60/mesg:", "LIVE7" => "/isw/appwork/general/finance/guifmxs:" , "LIVE8" => ".:" , "LIVE9" => "/isw/tpp/oracle/general/8.1.7/bin:" , "LIVE10" => "/isw/tpp/oracle/general/8.1.7/dbs" ) ; # ############################################################### # Set up variables # ############################################################### # Date and time variables for headings in Emails/files etc. # ############################################################### # my ($min, $hour, $day, $mon, $year) = (localtime) [1,2,3,4,5] ; # my $date = sprintf("%02d/%02d/%04d", $day, $mon +=1, $year += 1900); my $ren_date = sprintf("%04d%02d%02d", $year, $mon, $day) ; my $extract_date = sprintf("%04d%02d%02d" ,$year, $mon, $day) ; my $ptime = "$hour:$min" ; my $filedate = undef ; my $mday = undef ; my $mtime = undef ; my $fdate = undef ; # ################################ # Parameters # ################################ # my $DB_name = undef ; # ##################### # Current timestamp # ##################### # my $now = time ; # ################## # Cut-off dates # ################## # my $cdate = undef ; my $cday = undef ; my $cmon = undef ; my $cyear = undef ; # ################## # Start date # ################## # my $sdate = undef ; my $sday = undef ; my $smon = undef ; my $syear = undef ; my $p_sdate = undef ; # ############################################################### # Files & Directories # ############################################################### # my $logfile = 'ACC_ORACLE_ENV.log' ; # ############################################################### # mail_log variables. # ############################################################### # my $script = 'ACC_ORACLE_ENV' ; my $domain = 'mailhost' ; my $from = 'The Wonderful World Of Perl' ; my $subject = "URGENT - $script Failed!" ; my $msg = "This should change to reflect what is happening." ; my $attachments = undef ; # ###################################### # Email recipient lists # ###################################### # my $to = 'ronniec@it.aberdeen.net.uk' ; # ######################################## # Messages used by SUB end_it # ######################################## # my $null = "none" ; my $text = "Unable to write the following to $logfile :-\n" ; my $topline = "The error message is -\n" ; # ############################################################## # BOOLEAN VARIABLES # ############################################################## # my $mail_msg = 1 ; my $PARAMETER_ERROR = 0 ; # ############################################################### # COMMON OR GARDEN SCALAR VARIABLES # ############################################################### # my $param_no = 0 ; my $key = undef ; my $value = undef ; # ############################################################### # PROCESSING # ############################################################### # print "\n\t\t<***** SOR $script *****>\n" ; # ############################################################### # Check for Parameters # ############################################################### # $param_no = scalar @ARGV ; # if ($param_no == 1) { # One parameter has been supplied # $DB_name = $ARGV[0] ; if ($DB_name =~ /[ISWLIVE ISWTEST ISWTEACH]/) { print "\n\tProcessing $DB_name Environment.\n\n" ; } else { print "\n\tThink again muppett!\n" ; $msg = "$DB_name is not a database known to this script!" ; &end_it($mail_msg,$to,$from,$subject,$msg,$topline) ; } # } else { print "\n\t<***** There MUST be a parameter supplied! *****>" ; print "\n\n\t<***** $script Failed to run. *****>\n\n" ; $msg = "DB name parameter not supplied" ; &end_it($mail_msg,$to,$from,$subject,$msg,$topline) ; } # while (($key,$value) = each %$DB_name) { print "\tKey :: $key\n" ; print "\tValue :: $value\n" ; } # print "\n\t\t<***** EOR $script *****>\n" ;