The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Running scripts in parallel nivas Shell Programming and Scripting 6 02-21-2008 05:44 AM
Running scripts from home mastachef UNIX for Dummies Questions & Answers 2 12-07-2007 06:51 PM
running multiple scripts nvuradi Shell Programming and Scripting 3 08-13-2007 10:53 AM
scripts running under different users csnewbie UNIX for Dummies Questions & Answers 1 02-14-2007 04:52 PM
Running three scripts parallelly anwarsait Shell Programming and Scripting 1 07-18-2006 02:20 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-21-2006
santho santho is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 5
Running scripts parallely

Hi,
Posting my first query in this Forum,here's my query

i want to execute 100 .sql files in unix having some code for connecting with db and executing procedures inside that,that to be run parallel like threads.want to run all the 100 .sql files simultanously.

thanks in advance.
  #2 (permalink)  
Old 07-21-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,800
Note - you may run into process limits if you try 100 files at once.
Plus, you will run into performance problems unless your boxes has dozens of cpus.
I'm limiting it to 16, you can change that.

create a file (call it sql.lis ) with fully qualified names of the .sql files - e.g.,
/path/to/file1.sql
/path/to/file2.sql


Code:
#!/bin/ksh
let cnt=1
let lgcnt=0
username="me"
passwd="foo"
while read sql 
do
     echo "
       @"$sql"
       exit
     " | sqlplus -s "$username"/"$password"@myoracleinstance > /path/to/logs/sqllog_"$lgcnt".log_$$   &
    let cnt=$cnt+1
    let lgcnt=$lgcnt+1
    if [[ $cnt -eq 16 ]] ; then
         let cnt=0
         wait
    fi
done <  /path/to/sql.lis

  #3 (permalink)  
Old 07-23-2006
santho santho is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 5
can we do the same in sybase?

thanks for your reply.
but the log file are updating one after the other.
so i think it's executing one by one..
  #4 (permalink)  
Old 07-23-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,800
Yes, I just gave an Oracle example.

Unless you have multiple cpus, you will have only one process executing at a time, in a round-robin kind of affair. In other words, process #1 runs for 20ms, then process #2 gets 20ms, then process #3... and so on.

What UNIX and how many cpus on the box you are running these processes on?
  #5 (permalink)  
Old 07-23-2006
santho santho is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 5
query

Actually we are having a single unix server sun solaris 5.
simulatanouly 100 users will access the system.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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




All times are GMT -4. The time now is 09:21 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0