Triggering a Script Recursively With Different Parameter and in Different Process


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Triggering a Script Recursively With Different Parameter and in Different Process
# 1  
Old 02-12-2007
Triggering a Script Recursively With Different Parameter and in Different Process

Hi Every One

I have a Compilation Script name scomp which takes the Program name as the command line argument

I have around 10000 Programs to compile while each program takes around 10 mins to compile

i have written a Mass Compile script Scripts which takes the list of programs as input file and trigger the scomp for each Program in a for loop

Now the Problem is until compilation for one program is not finished it does not start the compilation for the next Program in my Mass Compilation Script

so to finish of all the 10000 Programs it take hell lot of time

so Is there any way that i can Trigger the scomp simultaneusly for many Programs at a time so the the overall compilation time reduces like creating one more process??


my Mass Compile Script is some thing like this

echo 'Enter file with list of programs :
'read INPUT
for I in $(cat $INPUT)
do
echo ${I}
/home/aixuser/scomp ${I}
done

I want to do this simultanesly for Programs given in Input file...
# 2  
Old 02-12-2007
You have two possible solutions....

1)
/home/aixuser/scomp ${I} &
This will run your command in the back ground then continue with execution of the script.
Problem - If you log out of the system the back ground jobs will die!

2)
nohup /home/aixuser/scomp ${I} &
This will run your command in the back ground and if you log out of the system the back ground processors will NOT DIE :-).

Try it out first to see if thats what you need.
# 3  
Old 02-13-2007
How can I can give input

Hi Andrek,
Your suggestion is nice. How can I give the input (if some script is required) for the background jobs?. The prompt will not be appear for the input.


Quote:
Originally Posted by Andrek
You have two possible solutions....

1)
/home/aixuser/scomp ${I} &
This will run your command in the back ground then continue with execution of the script.
Problem - If you log out of the system the back ground jobs will die!

2)
nohup /home/aixuser/scomp ${I} &
This will run your command in the back ground and if you log out of the system the back ground processors will NOT DIE :-).

Try it out first to see if thats what you need.
# 4  
Old 02-13-2007
Quote:
Originally Posted by Andrek
You have two possible solutions....

1)
/home/aixuser/scomp ${I} &
This will run your command in the back ground then continue with execution of the script.
Problem - If you log out of the system the back ground jobs will die!

2)
nohup /home/aixuser/scomp ${I} &
This will run your command in the back ground and if you log out of the system the back ground processors will NOT DIE :-).

Try it out first to see if thats what you need.

I dont think that solution would work
basically the unit of operation (from the script) is individually not provided to the interpretor and we cannot expect it to run parallely Smilie

Code:
>cat main.zsh
#! /bin/zsh
                                                                   
i=1
while [ $i -le 5 ]
do 

	# First modify the line as zsh print.zsh and run
	# Next time modify the line as zsh print.zsh & and run


	zsh print.zsh 
	i=$(($i + 1))
done
                                                                   
exit 0

Code:
>cat print.zsh
#! /bin/zsh
                                                                   
i=1;                                                                    
while [ $i -lt 10 ] 
do
	echo "$i"
	i=$(($i + 1))
	sleep 1
done
                                                                   
exit 0


After you run the above and if satisfied how it works,
modify the statement ( only ) where the actual compilation happens to a background job
# 5  
Old 02-13-2007
Quote:
Originally Posted by matrixmadhan
I dont think that solution would work
basically the unit of operation (from the script) is individually not provided to the interpretor and we cannot expect it to run parallely Smilie

Code:
>cat main.zsh
#! /bin/zsh
                                                                   
i=1
while [ $i -le 5 ]
do 

	# First modify the line as zsh print.zsh and run
	# Next time modify the line as zsh print.zsh & and run


	zsh print.zsh 
	i=$(($i + 1))
done
                                                                   
exit 0

Code:
>cat print.zsh
#! /bin/zsh
                                                                   
i=1;                                                                    
while [ $i -lt 10 ] 
do
	echo "$i"
	i=$(($i + 1))
	sleep 1
done
                                                                   
exit 0


After you run the above and if satisfied how it works,
modify the statement ( only ) where the actual compilation happens to a background job


Hi Madhan

Ya even when i try the Adrek concept i dont feel its running parallely

I have Tried giveing 10 Programs and the Scripts just got finished echoing the all files names

but if i look for the output files there are getting generated one by one only

And is there any way i can see all the Back ground Process Running to make sure if its really running in Back Ground parallely??
# 6  
Old 02-13-2007
Quote:
I have Tried giveing 10 Programs and the Scripts just got finished echoing the all files names

but if i look for the output files there are getting generated one by one only

Am really sorry I cannot understand the above,
are you saying that its not running in parallel or is that you acheive the desired effect.

Quote:
And is there any way i can see all the Back ground Process Running to make sure if its really running in Back Ground parallely??
Code:
jobs

Is that what you are looking for ?
# 7  
Old 02-13-2007
Quote:
Originally Posted by matrixmadhan
Am really sorry I cannot understand the above,
are you saying that its not running in parallel or is that you acheive the desired effect.

I wanted to run some Compilations parallely...

U can See the Thread Starting u will get a clear idea of what i want..

Code:
jobs

Is that what you are looking for ?
but
Code:
jobs

shows no out put on my screen.. (to see all back ground Process)
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Triggering a script using POSTFIX....

I have a mail server configured on my server (Postfix), I have a script which requires input to be provided to it. I would like to know if there is a possibility to trigger this script by sending mail to the server. This is what I am thinking: Once the mail arrives on server, the mail will... (6 Replies)
Discussion started by: davidbob
6 Replies

2. Shell Programming and Scripting

Triggering UNIX Script from a JAVA program

Hi I am trying to implement one program, where JAVA needs to trigger the backend UNIX script. Tried with options like String cmdArray = {"/bin/ksh","-c","/SCRIPT_ABSOLUTE_PATH/sampleScript.ksh /FILE_ABSOLUTE_PATH Test_File.dat TEST E SFTP"} When I trigger the script from front end with... (1 Reply)
Discussion started by: karumudi7
1 Replies

3. Shell Programming and Scripting

Call Script with Parameter (that has another parameter)

Hi. How do I achieve this sh /EDWH-DMT02/script/MISC/exec_sql.sh "@/EDWH-DMT02/script/others/CSM_CKC/Complete_List.sql ${file_name}" Complete_List.txt The /EDWH-DMT02/script/MISC/exec_sql.sh has two parameters and it's working fine with this sh /EDWH-DMT02/script/MISC/exec_sql.sh... (7 Replies)
Discussion started by: aimy
7 Replies

4. Shell Programming and Scripting

Triggering remote UNIX shell script from Remote desktop

I m trying to run a batch script in remote desktop which executes unix commands on the unix server...the problem is i wnt the output in HTML format.so in my batch script i m giving the cmd like ssh hostname path ksh HC_Report.ksh>out.html ...but it generates the HTML file in remote desktop .i... (2 Replies)
Discussion started by: navsan
2 Replies

5. Shell Programming and Scripting

Passing parameter to script, and split the parameter

i am passing input parameter 'one_two' to the script , the script output should display the result as below one_1two one_2two one_3two if then echo " Usage : <$0> <DATABASE> " exit 0 else for DB in 1 2 3 do DBname=`$DATABASE | awk -F "_" '{print $1_${DB}_$2}` done fi (5 Replies)
Discussion started by: only4satish
5 Replies

6. HP-UX

Need to identify the process/app which is triggering the error "vmunix: file: table is full"

Hi, I'm seeing the error vmunix: file: table is full in syslog.log. Although changing the value of the kernel parameter nfile would make this error go away, how would I identify which process/application in the server is triggering this error? The server is a HP-UX B.11.11. Thanks in advance! (1 Reply)
Discussion started by: enchogas
1 Replies

7. Shell Programming and Scripting

Best practice triggering a process?

Hi, Since I staterd working as Unix sysadmin (about 3 years ago) I always used to trigger a process evaluating the conditions needed to this process to be executed. Recently I've change the company where I work, and they usually create a trigger file to start a process or to stop a process while... (1 Reply)
Discussion started by: nefeli
1 Replies

8. UNIX for Dummies Questions & Answers

Script triggering Korn shell, how-to stop it?

Script_A.sh has echo "In am in script A" ksh ## K-shell is invoked. Script B.sh ## which I am writing... ./script_A.sh echo "I am in script B" return 0 When I run: $> Script_B.sh $> I am in script A $> Basically, on calling Script_A.sh from within Script_B.sh I have the issue of... (2 Replies)
Discussion started by: baivab
2 Replies

9. Shell Programming and Scripting

Triggering my Unix script....

Hi All, i dont have any idea about perl scripting... i need some suggestion so that i can put my effort to find out the solution:D let me explain....one of my tedious task which will taken care by Unix shell script which i prepared. its a kind of routine work that i am running the... (4 Replies)
Discussion started by: Shahul
4 Replies
Login or Register to Ask a Question