The UNIX Forums
"Join the Network of UNIX System Users"


 
Subject: background jobs exit status and limit the number of jobs to
napster_san
Newbie
Rank: 1



UID 12
Digest Posts 0
Credits 0
Posts 52
Reading Access 10
Registered Apr 25, 2007
Status Offline
Post at Jun 20, 2007 10:45 AM  Profile | P.M. 
background jobs exit status and limit the number of jobs to



background jobs exit status



i need to execute 5 jobs at a time in background and need to get the exit status of all the jobs i wrote small script below , i'm not sure this is right way to do it.any ideas please help.


$cat run_job.ksh

#!/usr/bin/ksh
####################################
typeset -u schema_name=$1
count=0
cat $home/tablist.list|
while read table
do
sas $table.sas &
count=`expr $count + 1`
echo $count
rc=$?
if (( $rc > 0 )); then
echo " executing the n't succes for $table rc "
exit 1
fi
cnt=$(jobs -l | wc -l )
if [[ $cnt -le 5 ]] ; then
continue
else
wait
#echo "in the wait mode"
fi

done
exit 0


last edited by grepme : 7 hours ago at 07:29 pm.


Top
bizoppz
Newbie
Rank: 1



UID 70
Digest Posts 0
Credits 0
Posts 54
Reading Access 10
Registered Apr 25, 2007
Status Offline
Post at Jun 20, 2007 10:45 AM  Profile | P.M. 
can somebody help me with this code



php code:
background jobs exit status and limit the number of jobs to run  



last edited by grepme : 13 hours ago at 01:20 pm.
Top
 

 

All times are GMT, the time now is Mar 15, 2010 03:45 PM

Powered by Discuz! 5.0.0  © 2001-2006 UNIX Forums
Processed in 0.005730 second(s), 8 queries

Clear Cookies - Contact Us - UNIX Help - Archiver - WAP