Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Executing commands via script after RSH to a remote host

Status
Not open for further replies.

ricbre

Technical User
Aug 18, 2004
2
US
Is there a way to execute commands on a remote host after RSHing to that host?

I've tried executing this script:

echo " "
echo " "
print "********** Remote Server *******"
echo " "
echo " "
rsh remoteserver
cd /tmp/logs
pg loga.log | grep backed
exit

but the script stops after the rsh to the remote server. When I hit the enter key, I only get the remote server command prompt. When I type "exit", I leave the remote server and the script continues executing the CD, PG, and EXIT commands on the local server.

What I want to be able to do is execute the CD and PG commands on the remote server, then EXIT from the remote server and continue with the script.
 
Have you tried something like this ?
rsh remoteserver "cd /tmp/logs;pg loga.log | grep backed"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
No, I hadn't tried that. But I did just now and it seems to be what I was looking for.

Thanks, PHV.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top