Unix/Linux Go Back    


Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

Local script to trigger multiple remote scripts

Shell Programming and Scripting


Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 01-10-2013
sain sain is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 17 January 2013, 4:49 PM EST
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Code Local script to trigger multiple remote scripts

Hi All,
I am facing problem running a script which triggers another script in multiple remote servers. my script in my local server looks like below

Code:
ssh server1 "sudo -u uname /usr/local/script/start.sh &2>&1 >/dev/null "
ssh server2 "sudo -u uname /usr/local/script/start.sh &2>&1 >/dev/null "
ssh server3 "sudo -u uname /usr/local/script/start.sh &2>&1 >/dev/null "

When I run this script, it ssh's to server1 and execute start.sh on server1, but control never come back to command prompt until I kill the process (ctrl+c). So only start.sh on server1 gets executed and have to manually start on server2 and server3.

Could some one please help me getting this resolved?
just an fyi- I am not very much familiar with unix Unix or Linux Image

Thanks,
Sain
Sponsored Links
    #2  
Old Unix and Linux 01-10-2013
RudiC RudiC is offline Forum Advisor  
Registered User
 
Join Date: Jul 2012
Last Activity: 27 April 2015, 7:09 AM EDT
Location: Aachen, Germany
Posts: 5,762
Thanks: 101
Thanked 1,522 Times in 1,431 Posts
On first sight, the &2>&1 looks very strange - what do you want to achieve therewith? On the other hand, it should not stop your local script...
Sponsored Links
    #3  
Old Unix and Linux 01-10-2013
sain sain is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 17 January 2013, 4:49 PM EST
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
I copied from a similar script. I even don't know what it does. Unix or Linux Image
I removed it and tried, but it is still the same, scripts on server2/3 never start.
Also, to mention when i start that script on my local, I see a logs written to my local screen, which is very strange for me..
    #4  
Old Unix and Linux 01-11-2013
RudiC RudiC is offline Forum Advisor  
Registered User
 
Join Date: Jul 2012
Last Activity: 27 April 2015, 7:09 AM EDT
Location: Aachen, Germany
Posts: 5,762
Thanks: 101
Thanked 1,522 Times in 1,431 Posts
Pls post the log.
Sponsored Links
    #5  
Old Unix and Linux 01-11-2013
sain sain is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 17 January 2013, 4:49 PM EST
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Actual start.sh on remote server starts few jvms which run in background, and logs of jvms starting up and directed to a log directory.
The same start up logs are written on the local screen until i kill that session(but it still logs on remote server, which means those jvms are up and running which is good)
I am trying to figure out how to ssh to a server, execute start.sh, exit that session and go to next remote server and so on.
Do I have to give an exit command after each line?
Sponsored Links
    #6  
Old Unix and Linux 01-12-2013
RudiC RudiC is offline Forum Advisor  
Registered User
 
Join Date: Jul 2012
Last Activity: 27 April 2015, 7:09 AM EDT
Location: Aachen, Germany
Posts: 5,762
Thanks: 101
Thanked 1,522 Times in 1,431 Posts
Pls post script and log.
Sponsored Links
    #7  
Old Unix and Linux 01-17-2013
sain sain is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 17 January 2013, 4:49 PM EST
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Local script to trigger multiple remote scripts [solved]

I found a solution for this from other forums
session would never exit as logs run in back ground, directed logs to /dev/null which helped exiting the session.
Thanks
Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Unix or Linux Image More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Executing local script/command on remote server dirtyd0ggy Shell Programming and Scripting 3 03-28-2012 05:18 AM
Move folders from Multiple remote Servers to my local computer idiazza UNIX for Advanced & Expert Users 5 09-19-2011 08:22 PM
Trigger a script by consequtive scripts in crontab EAGL€ Shell Programming and Scripting 1 12-04-2009 10:04 AM
How to stop a script running in remote server from local script mannepalli Shell Programming and Scripting 1 03-04-2009 07:18 PM
FTP multiple files from remote server to local server berlin_germany Shell Programming and Scripting 2 12-20-2006 02:24 AM



All times are GMT -4. The time now is 11:32 AM.