Mercurial > hg > index.fcgi > www > www-1
diff myrss/myrss_update.sh @ 27:f93693980ead
myrss: limit number of forked processes; tweak indexing; print both stdout and stderr from shell script to php page
author | paulo@thepaulopc |
---|---|
date | Sat, 04 Jun 2011 22:20:26 -0700 |
parents | fce61e65e3ae |
children |
line diff
1.1 --- a/myrss/myrss_update.sh Sat Jun 04 22:17:24 2011 -0700 1.2 +++ b/myrss/myrss_update.sh Sat Jun 04 22:20:26 2011 -0700 1.3 @@ -2,12 +2,19 @@ 1.4 1.5 TIMESTAMP=$(date '+%FT%T%:z') 1.6 TIMEOUT=60 1.7 +MAXPROCS=20 1.8 1.9 i=0 1.10 +n=0 1.11 for URL in $(grep -v '^#' FEEDS) 1.12 do 1.13 - FN=$((i++)).feedtmp 1.14 - wget -q -T ${TIMEOUT} -U '' -O - ${URL} | xsltproc step1.xsl - | xsltproc step2.xsl - > ${FN} & 1.15 + FN=$((++i)).feedtmp 1.16 + wget -q -T ${TIMEOUT} -U '' -O - ${URL} | xsltproc step1.xsl - | xsltproc step2.xsl - > ${FN} & 1.17 + if (( $((++n)) > ${MAXPROCS} )) 1.18 + then 1.19 + wait 1.20 + n=0 1.21 + fi 1.22 done 1.23 1.24 wait 1.25 @@ -21,7 +28,7 @@ 1.26 echo '<BODY>' 1.27 echo "<H1>${TIMESTAMP}</H1>" 1.28 1.29 -for j in $(seq 0 ${i}) 1.30 +for j in $(seq 1 ${i}) 1.31 do 1.32 cat ${j}.feedtmp 1.33 done