Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^8: Advice on running perl program over ssh

by Amblikai (Scribe)
on Jul 16, 2014 at 09:09 UTC ( [id://1093823]=note: print w/replies, xml ) Need Help??


in reply to Re^7: Advice on running perl program over ssh
in thread Advice on running perl program over ssh

Ignore my last reply! I've now got Net::OpenSSH installed locally. That was easy!

Now i just have to figure out how to use it! Any pointers or sample scripts?

Thanks!

Replies are listed 'Best First'.
Re^9: Advice on running perl program over ssh
by salva (Canon) on Jul 16, 2014 at 09:53 UTC
    The synopsis shows the most important things. To start learning how to use new, capture2 and error is enough and quite straight forward.

    There is a samples directory on the distribution, though, they are for advanced topics.

      Ok Thanks very much Salva

      I have it working, however I now have a new problem it seems!

      I have it working for normal commands such as ls, cd etc. But how do i read stdin to execute a local script as described above?

      The following doesn't work:

      $ssh->system("tcsh < script1.tcsh") or die "Remote command failed: ".£ +ssh->error;

      It appears to be looking for "script1.tcsh" on the remote machine which is not what i want.

      Also, how would i get more that one script to run in parallel?

      Thanks for your help, it's very much appreciated!

        $ssh->system({ stdin_file => 'script1.tcsh' }, 'tcsh') or die "Remote command failed: " . $ssh->error;

        Running things in parallel is not so easy. You have the spawn method that returns a PID, then you use perl built-ins as waitpid on the PID to wait for the remote process to finish.

Re^9: Advice on running perl program over ssh
by hippo (Bishop) on Jul 16, 2014 at 09:53 UTC

    Unsurprisingly there are sample scripts in the sample directory.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1093823]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-03-29 15:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found