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 and shell scripting languages 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 08-15-2008 06:58 PM
Remote login through ssh subin_bala Shell Programming and Scripting 5 08-14-2008 07:16 PM
Remote login with VNC Peterh UNIX for Dummies Questions & Answers 1 02-28-2008 06:32 AM
CDE Remote Login is not Working !!! adel8483 SUN Solaris 4 03-19-2007 06:35 AM
remote login through a script ( except rsh) rahma UNIX for Dummies Questions & Answers 3 08-23-2001 05:13 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-14-2005
Raom Raom is offline
Registered User
  
 

Join Date: Sep 2005
Location: india
Posts: 79
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.
  #2 (permalink)  
Old 10-14-2005
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
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.
  #3 (permalink)  
Old 10-14-2005
Raom Raom is offline
Registered User
  
 

Join Date: Sep 2005
Location: india
Posts: 79
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.
  #4 (permalink)  
Old 10-14-2005
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
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.
  #5 (permalink)  
Old 10-14-2005
Raom Raom is offline
Registered User
  
 

Join Date: Sep 2005
Location: india
Posts: 79
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
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:14 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0