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