Loading ...
Sorry, an error occurred while loading the content.

SSH can't find command

Expand Messages
  • Dukelow, Don
    I m doing a Perl SSH script and when I try to excite a command in my remote server login bin directory it can t find it. Although it does work when I give it
    Message 1 of 1 , Aug 19, 2008
    • 0 Attachment
      I'm doing a Perl SSH script and when I try to excite a command in my remote server login bin directory it can't find it. Although it does work when I give it an absolute path to it.

      sub run_quorum {
      my ($host, $hash) = @_;

      my $user = $hash->{$host}->{user};
      my $pass = $hash->{$host}->{pass};
      print "Running $host...\n";

      my $ssh = Net::SSH::Perl->new($host, protocol => '2');
      if ($pass eq 'na') {
      $ssh->login($user);
      } else {
      $ssh->login($user, $pass);
      }
      my ($stdout, $stderr, $exit) = $ssh->cmd("$lic_quorum_cmd");
      print "## $stderr\n";
      open OUT, ">/tmp/X_quorum_$host.dat" or die "\n\tCan not open quorum_$host.dat. $!\n";
      print OUT "$stdout";

      close OUT;
      return "OK" if ($exit == '0');
      }

      This is stderr that get printed out just running between servers, with the script in same place.

      Running cdlb10...
      ## ksh: lic_quorum.pl: not found

      Use of uninitialized value in string at /usr/local/bin/check_quorums4.pl line 109.
      Running cdlb11...
      ## ksh: lic_quorum.pl: not found

      Use of uninitialized value in string at /usr/local/bin/check_quorums4.pl line 109.
      Running cdlb12...
      ## ksh: lic_quorum.pl: not found

      Use of uninitialized value in string at /usr/local/bin/check_quorums4.pl line 109.


      I have to run this Perl SSH program where the remote Perl script isn't always in the same place. So I can't use absolute path for them all. I figure the problem is in how the remote login is set up but I don't under stand. Because the remote script does work if I SSH in manually and just type in script name.
      -----
      Don Dukelow
      HP License Team
      Hewlett-Packard Company
      Tel: 810-728-3388
      e-mail: dukelow@...
    Your message has been successfully submitted and would be delivered to recipients shortly.