Home > other >  Error while using SSH command in shell script
Error while using SSH command in shell script

Time:09-22

I have a shell script which does SSH to a remote machine to execute the perl script. the command is something like this $SSH -x "node" /perl/bin/perl -I/perl/lib <perlfilename>.pl <args..> which fails with an error 2

I looked at the file and perl library version it looks fine. The SSH error suggest it failed to connect to remote machine , whereas similar SSH command to execute a binary in the remote machine works fine. Is there any way that could be debugged further

CodePudding user response:

My guess is that the command line parser isn't seeing the target hostname properly. I am assuming that node is your target host.

Actually, there ought to be an actual failure message on stderr, not just an error code, and I'd like to see that.

But my suspicions are that possibly quoting the note is making trouble. Other options are that there is no machine named node on the network or that the ability of your machine to resolve the network machine named node is ineffective.

Some possible solutions include targeting more specifically such as by using the fully-qualified domain name (FQDN) - for example node.stackoverflow.com. Another option is to use the IP address of node and thereby bypass whatever name resolution problems you might be having.

  •  Tags:  
  • perl
  • Related