The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > Linux
Google UNIX.COM


Linux RedHat, Ubuntu, SUSE, Fedora, Debian, Mandriva, Slackware, Gentoo linux, PCLinuxOS. All Linux questions here!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
perl - why is the shell script executed before the print command? mjays Shell Programming and Scripting 3 09-21-2007 02:49 AM
Unix shell script couldn't be executed. Pls help! duke0001 Shell Programming and Scripting 8 09-14-2006 08:15 PM
Help - Need simple example of VI executed in shell script corsart AIX 2 06-03-2006 03:25 PM
executing a remote location script from local server srivsn Shell Programming and Scripting 2 02-28-2006 12:16 PM
Shell script doesn't get executed using crontab radhika Shell Programming and Scripting 11 06-09-2005 01:28 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 05-01-2008
Registered User
 

Join Date: Apr 2008
Posts: 8
Local shell script need to be executed on a remote linux box

I need to execute a shell script on a remote linux box. But the shell script resides on the local linux box where I am currently logged in. Is there a way to do this? I know rsh <host> <command> can execute a command on the remote host.
Reply With Quote
Forum Sponsor
  #2  
Old 05-01-2008
Registered User
 

Join Date: Apr 2008
Posts: 19
Sort Command!

When I am sorting a file I am getting a warning message
"Warning: A newline character was added to the end of file".

Please let me know hwy I am getting these warnings.

Thanks
Sumit
Reply With Quote
  #3  
Old 05-01-2008
Registered User
 

Join Date: May 2008
Posts: 6
ssh

hi,

login as root on your local machine and copy the sh file to remote system using scp command and ssh to remote system and execute there.
Reply With Quote
  #4  
Old 05-01-2008
Moderator
 

Join Date: Feb 2007
Posts: 2,332
Quote:
Originally Posted by sumitc View Post
When I am sorting a file I am getting a warning message
"Warning: A newline character was added to the end of file".

Please let me know hwy I am getting these warnings.

Thanks
Sumit
sumitc,

Don't hijack anothers thread but start a new thread.

Thanks.
Reply With Quote
  #5  
Old 05-01-2008
Registered User
 

Join Date: Apr 2008
Posts: 8
Quote:
Originally Posted by uneex View Post
hi,

login as root on your local machine and copy the sh file to remote system using scp command and ssh to remote system and execute there.
Is it interactive? does it require entering password?

I need to automate this - i.e., I need to write a script which does this (run the local script on the remote box) on may be 100 boxes one by one.
Reply With Quote
  #6  
Old 05-01-2008
nitin's Avatar
Registered User
 

Join Date: Aug 2001
Location: Toronto, ON
Posts: 56
SSH from local to remote

Rajesh,
Depends on what you really want to do? SSH is interactive, it's just like telnet, but secure.
You can ssh from your local Linux (or UNIX) to remote box and execute the script. Now, if you don't want to copy the script to the remote box, you can share a local directory using NFS (put your script in that dir). Then ssh to remote server, mount the NFS and execute the script. I think that is what you may be looking for. You can even automate all these steps too!

HTH,

Nitin
Reply With Quote
  #7  
Old 05-02-2008
Registered User
 

Join Date: Apr 2008
Posts: 8
I found that it can be done in 3 steps..

#1. remote copy your local script - this wont ask for password. i think you
# need to have same userid/passwd setup on the remote host
rcp yourscript.sh remote_hostname:/remote_path/yourscript.sh

#2. Execute the script on the remote box
rsh remote_host /remote_path/yourscript.sh

#3. Delete it
rsh remote_host rm /remote_path/yourscript.sh

Thanks for your responses...
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
linux

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 11:03 AM.


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

Content Relevant URLs by vBSEO 3.2.0