The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
script to monitor process running on server and posting a mail if any process is dead pradeepmacha Shell Programming and Scripting 13 03-06-2009 07:33 AM
passing parameter from Shell-script to Sql-script subodhbansal Shell Programming and Scripting 0 09-21-2007 07:15 AM
Parameter to script mahabunta Shell Programming and Scripting 2 02-13-2007 05:33 PM
Urgent Need for Assistance: Triggering Windows bat files from UNIX punyenye Windows & DOS: Issues & Discussions 0 03-16-2006 05:00 AM
triggering utility hedrict UNIX for Dummies Questions & Answers 1 08-04-2002 04: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 02-12-2007
pbsrinivas pbsrinivas is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 141
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 (permalink)  
Old 02-12-2007
Andrek Andrek is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 122
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 (permalink)  
Old 02-13-2007
sharif sharif is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 40
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 (permalink)  
Old 02-13-2007
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,960
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


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 (permalink)  
Old 02-13-2007
pbsrinivas pbsrinivas is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 141
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


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 (permalink)  
Old 02-13-2007
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,960
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 (permalink)  
Old 02-13-2007
pbsrinivas pbsrinivas is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 141
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)
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 10:58 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