LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 03-10-2008, 03:07 PM   #1
abefroman
Senior Member
 
Registered: Feb 2004
Location: Chicago
Distribution: CentOS
Posts: 1,249

Rep: Reputation: 53
What is the easiest way to run a shell script in the background on 10 servers?


What is the easiest way to run a shell script in the background on 10 servers?

I know you can do a for loop like:
for in server1 server2 ... server10; do `ssh -l root $i $cmd`; done;

but the script takes about a half hour to run, and the for loop won't go to the next server until one has finished.

Anyone know of a way to start the $cmd then go to the next server before it finishes?
 
Old 03-10-2008, 04:28 PM   #2
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, SolydK 2013
Posts: 7,434

Rep: Reputation: 134Reputation: 134
Quote:
Originally Posted by abefroman View Post

What is the easiest way to run a shell script in the background on 10 servers?

I know you can do a for loop like:
for in server1 server2 ... server10; do `ssh -l root $i $cmd`; done;

but the script takes about a half hour to run, and the for loop won't go to the next server until one has finished.

Anyone know of a way to start the $cmd then go to the next server before it finishes?
You could try running each command in the background.

----------------
Steve Stites
 
Old 03-10-2008, 05:37 PM   #3
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 62
Check out clusterssh: http://clusterssh.sourceforge.net/
 
Old 03-12-2008, 09:24 AM   #4
abefroman
Senior Member
 
Registered: Feb 2004
Location: Chicago
Distribution: CentOS
Posts: 1,249

Original Poster
Rep: Reputation: 53
I tried cluster-ssh, dsh, and fanout

Couldn't get cluster-ssh to work via a remote connection to the terminal, dsh worked the same way as the for loop, and fanout worked perfectly:
http://www.stearns.org/fanout/README.html#fanout
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to stop a process running in background (on a shell script) Azk00 Linux - Newbie 3 02-01-2008 04:24 AM
How to run a shell script in a background? anandv_1234 Linux - Newbie 3 12-23-2007 03:03 AM
shell script switching it self into background process knockout_artist Linux - Software 3 11-24-2007 11:33 AM
how do i get a shell script to run in the background? tjyorkshire Programming 4 07-06-2007 02:28 AM
verify if the same shell script is executing in background hicham007 Programming 2 08-07-2005 05:40 AM


All times are GMT -5. The time now is 02:03 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration