LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-18-2012, 03:09 PM   #1
predator_neelu
LQ Newbie
 
Registered: Aug 2012
Posts: 3

Rep: Reputation: Disabled
running multiple unix scripts parallel


Hi Folks,

I have made a shell scripts which does some grep on logs and puts the output in one text file. Basically this script is kept on 10 other servers from where the output text file will be SCP to the host server. Now from the host server i need to invoke all the script at one go so that i get all the 10 log files in minimum time (almost parallel). The scripts on each server take around 10 secs to complete.

Thanks!!
 
Old 08-18-2012, 03:21 PM   #2
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,027

Rep: Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845
seems as easy as:
Code:
ssh user@192.168.0.1 command.ksh &
ssh user@192.168.0.2 command.ksh &
ssh user@192.168.0.3 command.ksh &
...
ssh user@192.168.0.10 command.ksh &
unless i'm missing something.
 
Old 08-18-2012, 03:44 PM   #3
predator_neelu
LQ Newbie
 
Registered: Aug 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thank you Sir.

Just to make more clear.
I have same script on 10 different client server which will create on output text file on its respective client server. The o/p txt file takes 10 secs to generate. Now from my host server i need to invoke the all the client scripts. If I invoke all the 10 scripts via for loop in my host script then it would take 10*10 = 100 seconds to get all the o/p files on host machine. But if i invoke all of them in parallel then i may get all the 10 o/p files on host in 10 secs. This will save a lot of time for me.

Please let me know on this. Thanks for all the patience again.
 
Old 08-18-2012, 03:52 PM   #4
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,027

Rep: Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845
not sure if you saw my previous response but for each command the '&' tells the shell to background the command and execute the next statement without waiting for the command to finish.
 
1 members found this post helpful.
Old 08-18-2012, 03:56 PM   #5
predator_neelu
LQ Newbie
 
Registered: Aug 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thanks Again. I will try this and post the result. Thanks again!
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Running scripts in parallel Disha_Pandey Linux - Newbie 4 11-19-2011 09:57 AM
Running scripts in parallel Disha_Pandey Linux - Newbie 1 11-18-2011 09:59 PM
LXer: Running Multiple MySQL Server Instances in Parallel on a Linux Server LXer Syndicated Linux News 0 10-11-2010 01:00 PM
How to execute two shell scripts in parallel Pavitra.v Linux - General 4 09-16-2006 06:59 AM
Parallel Execution Capable Scripts? irfanhab Programming 5 08-28-2004 07:04 AM


All times are GMT -5. The time now is 10:38 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration