LinuxQuestions.org
Visit Jeremy's Blog.
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 11-18-2011, 09:19 PM   #1
Disha_Pandey
LQ Newbie
 
Registered: Nov 2011
Posts: 3

Rep: Reputation: Disabled
Running scripts in parallel


I want to run several other shell scripts from this script to run them in parallel (not serially)...save the output of those scripts in different files and they should all show the date (in the saved files, not on screen)..

How can I modify the below script accordingly?

#!/bin/bash
sqlplus -s performance/oracle@WAMS<<eof
set serveroutput on;
SELECT SYSDATE FROM dual;
eof
 
Old 11-18-2011, 09:30 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian, Mint, OpenBSD
Posts: 11,342
Blog Entries: 12

Rep: Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730
I just heard about GNU Parallel on a podcast today. Perhaps you will find it useful:

http://www.gnu.org/s/parallel/

Here's the link to the podcast: http://hackerpublicradio.org/eps.php?id=0860
 
Old 11-18-2011, 09:46 PM   #3
Disha_Pandey
LQ Newbie
 
Registered: Nov 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
Can you help me modify the above shell script which I have written for parallel execution?
 
Old 11-18-2011, 09:55 PM   #4
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian, Mint, OpenBSD
Posts: 11,342
Blog Entries: 12

Rep: Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730
No, I'm a mere BASH beginner, but the GNU Parallel is GPL, so you could see how he did it. I do recall this is a PERL script, but it might give you some hints.

I would happily help if I could.
 
Old 11-19-2011, 09:57 AM   #5
tange
LQ Newbie
 
Registered: Jul 2010
Posts: 13

Rep: Reputation: 9
Quote:
Originally Posted by Disha_Pandey View Post
I want to run several other shell scripts from this script to run them in parallel (not serially)...save the output of those scripts in different files and they should all show the date (in the saved files, not on screen)..

How can I modify the below script accordingly?

#!/bin/bash
sqlplus -s performance/oracle@WAMS<<eof
set serveroutput on;
SELECT SYSDATE FROM dual;
eof
It is unclear what you want. The script you have cannot be parallelized as there is only one sql job to be run. But if you have loads of these jobs they can be run in parallel using parallel and sql (both part of GNU Parallel):

Code:
$ cat sqljobs
SELECT SYSDATE FROM dual;
SELECT 1+2 FROM dual;
SELECT * FROM foo;
... (other SQL statements you want to run in parallel - one per line)
Code:
$ cat sqljobs | parallel -j10 sql oracle://scott:tiger@ora.example.com/xe ">"{#}
It will save the output from each job into a file called the job number of sqljobs.

Adjust -j10 to run more/less jobs in parallel (-j0 = as many as possible - which may overload your Oracle server).

If that is not what you want you need to give 3 examples of the jobs you want run in parallel and the corresponding file names they should be saved as.

Last edited by tange; 11-19-2011 at 10:06 AM.
 
  


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
is suid disabled from running all scripts or just from running them as root monsteriname Programming 2 09-05-2009 03:57 AM
Parallel Shell scripts to execute using LAM?? vallme2003 Programming 6 03-12-2009 06:49 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 11:16 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