diff myrss/myrss_update.sh @ 18:3551de5fef13

update FEEDS; parallelize feed processing
author paulo@thepaulopc
date Wed, 10 Nov 2010 00:05:53 -0800
parents 5a0c2ee709f8
children fce61e65e3ae
line diff
     1.1 --- a/myrss/myrss_update.sh	Wed Sep 29 22:04:46 2010 -0700
     1.2 +++ b/myrss/myrss_update.sh	Wed Nov 10 00:05:53 2010 -0800
     1.3 @@ -1,6 +1,22 @@
     1.4  #!/bin/sh
     1.5  
     1.6  TIMESTAMP=$(date '+%FT%T%:z')
     1.7 +TIMEOUT=60
     1.8 +
     1.9 +i=0
    1.10 +for URL in $(grep -v '^#' FEEDS)
    1.11 +do
    1.12 +	FN=$((i++)).feedtmp
    1.13 +	wget -q -T ${TIMEOUT} -U '' -O - ${URL} | xsltproc step1.xsl - | xsltproc step2.xsl - > ${FN} &
    1.14 +done 
    1.15 +
    1.16 +wait
    1.17 +
    1.18 +BODY=''
    1.19 +for j in $(seq 0 ${i})
    1.20 +do
    1.21 +	BODY=${BODY}$(cat ${j}.feedtmp)
    1.22 +done
    1.23  
    1.24  echo '<HTML>'
    1.25  echo '<HEAD>'
    1.26 @@ -11,10 +27,9 @@
    1.27  echo '<BODY>'
    1.28  echo "<H1>${TIMESTAMP}</H1>"
    1.29  
    1.30 -for URL in $(grep -v '^#' FEEDS)
    1.31 -do
    1.32 -	wget -q -U '' -O - ${URL} | xsltproc step1.xsl - | xsltproc step2.xsl - 
    1.33 -done 
    1.34 +echo ${BODY}
    1.35  
    1.36  echo '</BODY>'
    1.37  echo '</HTML>'
    1.38 +
    1.39 +rm *.feedtmp