Running scripts parallely


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Running scripts parallely
# 1  
Old 07-21-2006
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  
Old 07-21-2006
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  
Old 07-23-2006
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  
Old 07-23-2006
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  
Old 07-23-2006
query

Actually we are having a single unix server sun solaris 5.
simulatanouly 100 users will access the system.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to run scripts parallely inside shell script?

Hi , I have 4 scripts example script1,script2,script3,script4 . I have to run script1,script2 and script3 parallely since this 3 scripts dont have dependencies . Once script1,script2 and script3 got completed successfully , I have to trigger script4. Can someone help me on this how to... (10 Replies)
Discussion started by: vinothsekark
10 Replies

2. UNIX for Dummies Questions & Answers

Running scripts from different server

Hi, I need a script (ksh) on ServerAdmin that will run an archive scripts from different several Servers through ssh. The problem is that how can i switch user when before running the archive script. I already configured password-less connection on the servers. server 1... (1 Reply)
Discussion started by: chococrunch6
1 Replies

3. Shell Programming and Scripting

running scripts in minicom

Hi, I am new to use minicom. I want script to run on minicom with username and password as automated.(Expect). please could anyone suggest the sample code for it. Thanks in advance (2 Replies)
Discussion started by: vanid
2 Replies

4. Homework & Coursework Questions

Help running scripts in 1 file.

1. The problem statement, all variables and given/known data: Running different parts of the assignment together in 1 script 2. Relevant commands, code, scripts, algorithms: awk, nawk, bash, cp, cut, echo, expr, grep, join, mkdir, paste, rm, sort, sed, test, tr, true and false. 3. The... (0 Replies)
Discussion started by: bigubosu
0 Replies

5. Shell Programming and Scripting

Running 2 scripts one after the other using cron

I would like to run two scripts using cron one immediately after the other. Is it enough to put them one after another in the cron file to run at the same time, or will this cause them to run concurrently? (4 Replies)
Discussion started by: 3210
4 Replies

6. Shell Programming and Scripting

Running scripts within scripts from cron

Hi all, I have set up a cron job which calls another shell script shell script which in turn calls a Java process. The cron tab looks so. 0,30 7-18 * * 1-5 /u01/home/weblogic/brp/bin/checkstatus.sh >> /u01/home/weblogic/logs/checkstatus.log The checkstatus.sh scripts looks like this. ... (4 Replies)
Discussion started by: sirbrian
4 Replies

7. Shell Programming and Scripting

Running scripts via su

Hi All, Am using the below command to start my application using the root user su - bin -c "/home/bin/test/start.sh" but am getting the error becaue i have set some environment varibales in bin .profile when i execute the command start.sh by logging directly into bin account it's... (8 Replies)
Discussion started by: ravi.sri24
8 Replies

8. UNIX for Dummies Questions & Answers

Automatically Running Scripts

Can someone advise me how to get started automatically running scripts? I believe it has something to do with cron? (4 Replies)
Discussion started by: jeffreydavisjr
4 Replies

9. Shell Programming and Scripting

Running scripts through cronjob.

Hello everybody, I'm trying to run a shell script in crontab file. But anyhow it's not getting executed. Following is the command that I've used in crontab. 30 07 * * * . ./.cronprofile;/om/reports/reportscripts/jitu/prod/prd_pre_to_post.sh 35 11 * * * .... (3 Replies)
Discussion started by: jitu.jk
3 Replies

10. UNIX for Dummies Questions & Answers

Running scripts from home

I have created a Bourne shell script that helps with metric counting and it has to be run in a ClearCase view. It has been placed in a directory where if User A cd'd to it and runs it, a bunch of errors occur. Because this is a tool that several users would want access to and the program assumes... (2 Replies)
Discussion started by: mastachef
2 Replies
Login or Register to Ask a Question