blink has asked for the wisdom of the Perl Monks concerning the following question:
Just in case someone may ask, "test.out" does get opened and written to, this code executes as root, "oraenv" is an executable with sufficient privileges.
Here's the code:
#!/usr/bin/perl -w use strict; my ( $ScriptName, $TAG ); my $file = "/export/home/scratch/test.out"; my $oratabFile = "/var/opt/oracle/oratab"; my $date = `/bin/date`; open ORATAB, "<$oratabFile" or die "$!\n"; open FILE, ">>$file" or die "$!\n"; my ( $host, $sid, $type ) = split ( '\_', $ENV{NB_ORA_PC_SCHED} ); while ( my $oraLine = <ORATAB> ) { chomp $oraLine; my ( $oraSID, $oraHome, $oraType ) = split ( '\:', $oraLine ); if ( $oraSID = $sid ) { $ENV{ORACLE_HOME} = $oraHome; $ScriptName = "$oraSID" . '_' . "$type.sh"; $TAG = $ENV{NB_ORA_PC_SCHED}; } } $ENV{ORAENV_ASK} = "NO"; $ENV{ORACLE_SID} = $sid; `export ORAENV_ASK ORACLE_SID ORACLE_HOME`; system(". /apps/oracle/bin/oraenv"); #################################### # # # Begin loop which will determine # # what type of backup to run # # # #################################### print FILE "\n\n\n"; print FILE "$ENV{NB_ORA_PC_SCHED} is a COLD backup"; print FILE "\n\n\n"; print FILE "====================================================\n"; print FILE "Printing environmental vars for troubleshooting\n"; print FILE "====================================================\n"; print FILE "\n\n\n"; print FILE `/usr/ucb/printenv`; print FILE "\n\n\n"; print FILE "====================================================\n"; print FILE "End Troubleshooting Section\n"; print FILE "====================================================\n"; print FILE "\n\n\n"; close ORATAB; close FILE;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to execute a Korn shell ". <some-file>" from within Perl
by sauoq (Abbot) on Jan 30, 2003 at 06:18 UTC | |
|
Re: How to execute a Korn shell ". <some-file>" from within Perl
by helgi (Hermit) on Jan 30, 2003 at 09:58 UTC | |
|
Re: How to execute a Korn shell ". <some-file>" from within Perl
by runrig (Abbot) on Jan 30, 2003 at 03:23 UTC | |
by blink (Scribe) on Jan 30, 2003 at 06:10 UTC |