in reply to Perl (Net::SSH::Perl) script sometimes hangs while running remote command but shell script works
I have observed that the script hangs rarelyThat indicates a bug somewhere. Use strace or some similar tool to discover what every component is doing. Your Java application or the wrapper may be waiting for something.
You can also enable debugging on Net::OpenSSH to see what is happening at the perl level:
$Net::OpenSSH::debug = -1;
are bash scripts faster when it comes to execution than its perl counterpart?
Perl code is usually faster than shell code. On scripts that invoke external commands, there is usually no difference between the two.
If your Perl script is slower it probably means that it is doing things in a different way.
In some cases, I also notice that a bash script prints messages that my perl script doesn’t.
Net::OpenSSH provides you several methods to redirect or capture the stdio streams of the remote process. You have to pick the ones that you need.
For instance, I had an issue where deployment was not happening on machine A. On investigation, I came to know that Java was not deployed. This I came to know when I logged into machine A and ran the bash script that my perl script was calling. I thought of triggering the same bash script using another bash script remotely from the same machine where my perl script was. I did see the Java missing message. Why is it so? Why is my perl script unable to capture the error message despite using ‘$ssh->error’ in my script?
That means that your wrapper script is hiding it. $ssh->error returns an error code when the remote command exits with a non zero value.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl (Net::SSH::Perl) script sometimes hangs while running remote command but shell script works
by Technext (Acolyte) on Jun 19, 2015 at 08:46 UTC | |
by Technext (Acolyte) on Jul 01, 2015 at 18:33 UTC |