annotate 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
rev   line source
paulo@8 1 #!/bin/sh
paulo@8 2
paulo@9 3 TIMESTAMP=$(date '+%FT%T%:z')
paulo@18 4 TIMEOUT=60
paulo@18 5
paulo@18 6 i=0
paulo@18 7 for URL in $(grep -v '^#' FEEDS)
paulo@18 8 do
paulo@18 9 FN=$((i++)).feedtmp
paulo@18 10 wget -q -T ${TIMEOUT} -U '' -O - ${URL} | xsltproc step1.xsl - | xsltproc step2.xsl - > ${FN} &
paulo@18 11 done
paulo@18 12
paulo@18 13 wait
paulo@18 14
paulo@18 15 BODY=''
paulo@18 16 for j in $(seq 0 ${i})
paulo@18 17 do
paulo@18 18 BODY=${BODY}$(cat ${j}.feedtmp)
paulo@18 19 done
paulo@8 20
paulo@9 21 echo '<HTML>'
paulo@9 22 echo '<HEAD>'
paulo@9 23 echo "<TITLE>${TIMESTAMP}</TITLE>"
paulo@9 24 echo '<LINK REL="stylesheet" TYPE="text/css" HREF="index.css">'
paulo@9 25 echo '</HEAD>'
paulo@9 26
paulo@9 27 echo '<BODY>'
paulo@9 28 echo "<H1>${TIMESTAMP}</H1>"
paulo@8 29
paulo@18 30 echo ${BODY}
paulo@9 31
paulo@9 32 echo '</BODY>'
paulo@9 33 echo '</HTML>'
paulo@18 34
paulo@18 35 rm *.feedtmp