jayakumark has asked for the wisdom of the Perl Monks concerning the following question:
I am getting error sh: ssh : not found.. but i can see /usr/local/bin (where ssh residess) in $ENV{PATH}. what may be the issue? Can somebody helpme on this. Thanks in advance.SSHOpen("10.4.5.6", "admin"); sub SSHOpen { my $ip_address = shift @_; my $ssh_login = shift @_; print STDERR "Opening SSH Connection to $ip_address (as $ssh_login +)\n"; my $ssh_reader = new FileHandle; my $ssh_writer = new FileHandle; my $cmd; if (defined($ssh_login) && $ssh_login ne "") { $cmd = "ssh -l $ssh_login -o 'Batchmode yes' $ip_address 2>&1" +; } else { $cmd = "ssh -o 'Batchmode yes' $ip_address 2>&1"; } print STDERR "\tRunning <$cmd>\n"; my $pid = open2($ssh_reader, $ssh_writer, $cmd); if ($pid <= 0) { print STDERR "\tSSH could not connect!\n"; close($ssh_reader) if defined($ssh_reader); close($ssh_writer) if defined($ssh_writer); return 1; } print STDERR "Open 2 Successfull with pid $pid \n"; $ssh_reader->autoflush(); $ssh_writer->autoflush(); print STDERR "SSH Reader and Write Autoflush \n"; my %ssh = (); $ssh{'object_type'} = "SSH"; $ssh{'reader'} = $ssh_reader; $ssh{'writer'} = $ssh_writer; # lets test the connection by sending a blank command print STDERR "\tSuccessful End of SSHOpen Funtion\n"; return (0, \%ssh); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: What is the path used by open2
by liverpole (Monsignor) on Jul 26, 2006 at 15:25 UTC | |
by Anonymous Monk on Jul 26, 2006 at 16:38 UTC | |
by Anonymous Monk on Jul 26, 2006 at 15:40 UTC |