LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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, 08: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, 08:30 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,324
Blog Entries: 28

Rep: Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142
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, 08: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, 08:55 PM   #4
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,324
Blog Entries: 28

Rep: Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142
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, 08: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 09:06 AM.
 
  


Reply



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 02:57 AM
Parallel Shell scripts to execute using LAM?? vallme2003 Programming 6 03-12-2009 05:49 PM
How to execute two shell scripts in parallel Pavitra.v Linux - General 4 09-16-2006 05:59 AM
Parallel Execution Capable Scripts? irfanhab Programming 5 08-28-2004 06:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:39 PM.

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
Open Source Consulting | Domain Registration