The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Remote ssh login as root BG_JrAdmin SUN Solaris 14 1 Week Ago 02:58 PM
Remote login through ssh subin_bala Shell Programming and Scripting 5 2 Weeks Ago 03:16 PM
Remote login with VNC Peterh UNIX for Dummies Questions & Answers 1 02-28-2008 02:32 AM
CDE Remote Login is not Working !!! adel8483 SUN Solaris 4 03-19-2007 02:35 AM
remote login through a script ( except rsh) rahma UNIX for Dummies Questions & Answers 3 08-23-2001 01:13 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-13-2005
Registered User
 

Join Date: Sep 2005
Location: india
Posts: 78
remote login

Hi

i have recently switched to unix environment,i am trying to make a shell script
which logs on to the remote machines and plays some commands and collects the out put into a file.but i am not able to create any file on remote hosts.see
the sample code .

rsh hostname -l username << ENDTAG
cd /in/service
ls -ltr >> tmp.stats
exit
ENDTAG

all the hosts are connected in LAN .could any body please help me out.
thanks in advance.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 10-13-2005
blowtorch's Avatar
Supporter
 
Join Date: Dec 2004
Location: Singapore
Posts: 2,322
Try this:
Code:
rsh/remsh hostname -l username "cd /in/service; ls -ltr > tmp.stats"
This will create a file called tmp.stats in the /in/service directory on the remote system.
Reply With Quote
  #3 (permalink)  
Old 10-13-2005
Registered User
 

Join Date: Sep 2005
Location: india
Posts: 78
thanks for the code, but i have too many commands to run through a shell script it takes the hostname and username as arguments from a file on local machine and procedes to create tmp.stats file on that host.
Reply With Quote
  #4 (permalink)  
Old 10-14-2005
blowtorch's Avatar
Supporter
 
Join Date: Dec 2004
Location: Singapore
Posts: 2,322
So why not do this: write all the commands that you want to execute into a script. Then execute the following sequence of commands:
Code:
rcp script_to_execute remote_host:/tmp/script_to_execute
rsh/remsh remote_host -l username /tmp/script_to_execute
rsh/remsh remote_host -l username rm /tmp/script_to_execute
Your redirection and stuff can all go into the script.
Reply With Quote
  #5 (permalink)  
Old 10-14-2005
Registered User
 

Join Date: Sep 2005
Location: india
Posts: 78
Thanks alot blowtorch
i thought of doing it with style of code i have given as sample but that was failed. i have tried your code thats working .
thanq
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:10 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0