Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I have a problem that is driving me to the brink.

I am calling an external script from a daemonized perl script. The external perl script is used to connect to a NetApp filer and get the major and minor API release level, and return in to the calling daemon.

Here's my problem. Sometimes the daemon script collects the stdout of the external, and in other cases it doesn't. However, when the external script is run from the command line, it works in all cases.

Here's my code snippet where I call the external.

my $get_version_prog = 'na_get_version.pl'; my $major_minor = qx($Bin/$get_version_prog $filer)

Both the daemon and the external use syslog to write to the application log file. Here's the final processing from the external:

syslog('notice', "Version info for $filer $major_minor"); print STDOUT $major_minor; exit 0;

and here's what I log from the daemon:

syslog('debug', "OnTap major/minor for $filer is $major_minor");

and finally, here's what shows up in the log file:

Mar 23 15:38:51 sppubu01 snapaidd[639]: [ID 702911 local7.notice] Gett +ing version info for SP1STONC02 Mar 23 15:38:53 sppubu01 snapaidd[639]: [ID 702911 local7.notice] Vers +ion info for SP1STONC02 1.31 Mar 23 15:38:53 sppubu01 snapaidd[636]: [ID 702911 local7.debug] OnTap + major/minor for SP1STONC02 is

So, the external logs the proper version info, but the print to STDOUT is not captured by the qx.

As I said before, running the external stand-alone prints the proper version info. More weird is that the daemon works as expected if the returned OnTap version from the NetApp is 1.21; it only fails if the returned OnTap version is 1.31, and only fails when being invoked through the daemon. However, the external is connecting to the NetApp, getting the proper API release, and logging it.


In reply to qx not always capturing stdout by StuLong

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-03-29 06:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found