in reply to How to hold execution of perl script while it runs command on remote machine

If perl is moving on to other statements, then the command has finished on the remote server, or you've found a nasty bug inside Net::SSH:Perl. I suspect that something else is going wrong here, so here's how I'd debug it.

First off, inside your perl script add some statements showing the result of the command; a quick-and-dirty way would be:

use Data::Dumper; my $cmd = Generate_Command($arg1,$arg2); print Dumper([$ssh->cmd($cmd)]); $cmd = Generate_Another_Command($arg1,$arg2); print Dumper([$ssh->cmd($cmd)]);
Then, assuming that alone doesn't produce any useful diagnostic information, try modifying your shell script on the remote server to be a bit noisier:
#! /bin/sh set -x CLASSPATH=/usr/local/classes/classes12.zip PATH=/usr/local/java/bin:$PATH LD_LIBRARY_PATH=/usr/local/tonga/lib export CLASSPATH export PATH export LD_LIBRARY_PATH echo "About to start java at `date`" /usr/local/tonga/bin/javadb dbVersion $1 javastat=$? echo "Finished java at `date` with status $javastat" exit $javastat
I strongly suspect that the combination of these two changes will show that something else is going on, if the answer isn't apparent as soon as you make the first perl change above.
-- @/=map{[/./g]}qw/.h_nJ Xapou cets krht ele_ r_ra/; map{y/X_/\n /;print}map{pop@$_}@/for@/

Replies are listed 'Best First'.
Re^2: How to hold execution of perl script while it runs command on remote machine
by linuxfan (Beadle) on Feb 22, 2005 at 20:01 UTC
    As weird as this may sound, I ran my script against a different server (where all the commands run), and have not faced any problems since then. Thanks much for your suggestions!