![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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. |
|
||||
|
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
|
|
||||
|
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? |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|