Solved

Perl Interpretation Help

Posted on 2015-02-18
6
114 Views
Last Modified: 2015-02-19
Would someone tell me what these perl lines are doing.  There is a query called standby_check.sh being executed.  If i execute it standalone, i get rows returned, but for some reason it seems here it comes back empty.


open(DBQ, "/var/sysadm/oracle/bin/standby_check.sh|")
  or die("Failed to run standby_check.sh\n!$\n");

while (<DBQ>) {
  if (/^(.+?\.arc)\s*$/) {
    $fileName = $1;
0
Comment
Question by:xoxomos
6 Comments
 
LVL 26

Accepted Solution

by:
wilcoxon earned 500 total points
ID: 40617759
# run /var/sysadm/oracle/bin/standby_check.sh and pipe the output to the DBQ filehandle
open(DBQ, "/var/sysadm/oracle/bin/standby_check.sh|")
  or die("Failed to run standby_check.sh\n!$\n");

# loop over lines from the output referenced by DBQ
while (<DBQ>) {
  # if the line ends with .arc
  if (/^(.+?\.arc)\s*$/) {
    # then assign the line (minus any trailing whitespace) to the variable $fileName
    $fileName = $1;

Open in new window

0
 

Author Comment

by:xoxomos
ID: 40617799
Thanx

The standby_check.sh returns:
.....
.....
.
.
.
.
/archlog2/BB60/1_291803_786457154.arc
/archlog2/BB60/1_291804_786457154.arc
/archlog2/BB60/1_291805_786457154.arc
/archlog2/BB60/1_291806_786457154.arc
/archlog2/BB60/1_291807_786457154.arc
/archlog2/BB60/1_291808_786457154.arc
/archlog2/BB60/1_291809_786457154.arc
/archlog2/BB60/1_291810_786457154.arc
/archlog2/BB60/1_291811_786457154.arc
/archlog2/BB60/1_291812_786457154.arc

92 rows selected.
What are some possible reasons perl dies at the open or die stage
0
 
LVL 48

Expert Comment

by:Tintin
ID: 40617875
What are some possible reasons perl dies at the open or die stage

1.  The script doesn't exist
2.  The script doesn't have execute permission
3.  The Perl script doesn't have sufficient privilege to run the script
4.  The script exits with a non-zero status.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:xoxomos
ID: 40617900
Never mind.  I was root then did a crontab oracle.cron and got things mucked up.
0
 
LVL 84

Expert Comment

by:ozo
ID: 40619791
die("Failed to run standby_check.sh\n$!\n");
instead of
die("Failed to run standby_check.sh\n!$\n");
may give some indication of possible reasons
0
 

Author Comment

by:xoxomos
ID: 40619988
OZO!!!!  Long time :-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Most Common two letters at the start of a word. 1 85
HTTP Error 502.2 - Bad Gateway 3 205
delete query using perl dbi 3 96
Union rows in array that have common elements 2 89
I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now