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