StuLong has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: qx not always capturing stdout
by dasgar (Priest) on Mar 23, 2016 at 21:50 UTC | |
Re: qx not always capturing stdout
by graff (Chancellor) on Mar 24, 2016 at 04:29 UTC | |
by GrandFather (Saint) on Mar 24, 2016 at 23:58 UTC | |
Re: qx not always capturing stdout
by Paladin (Vicar) on Mar 23, 2016 at 21:42 UTC | |
by StuLong (Acolyte) on Mar 23, 2016 at 22:26 UTC | |
Re: qx not always capturing stdout
by Anonymous Monk on Mar 23, 2016 at 22:19 UTC | |
Re: qx not always capturing stdout
by Marshall (Canon) on Mar 23, 2016 at 21:16 UTC | |
by ikegami (Patriarch) on Mar 24, 2016 at 14:28 UTC | |
by Paladin (Vicar) on Mar 23, 2016 at 21:35 UTC | |
by StuLong (Acolyte) on Mar 23, 2016 at 21:20 UTC | |
by FreeBeerReekingMonk (Deacon) on Mar 24, 2016 at 00:26 UTC |