need to do multiple SSH hops using Perl script.

P

pradeep nair

The script must:

1. ssh to system A ,from there ssh to system B & from there ssh to
system C.
2. At system C need to connect to a DB and execute few queries and
create an output file
3. The outfile should be SCpied to Sytem A



Using command ssh -L -T, I am able to end up at System C with perl
command system. Am stuck there as in the output the cursor remains at
system C but I need the script to perform step 2 and 3 as mentioned
above.


Thanks in advance,
pRADEEP
 
M

Martijn Lievaart

The script must:

1. ssh to system A ,from there ssh to system B & from there ssh to
system C.
2. At system C need to connect to a DB and execute few queries and
create an output file
3. The outfile should be SCpied to Sytem A

If the script is on host C:
ssh A ssh b ssh C <script> >outfile

If the script is on host A:
cat <script> | ssh A ssh b ssh C sh - >outfile

So first make a script on C that works, then try to execute it via ssh

HTH,
M4
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top