From 7a64425751a5b510443556dab2281d0d8dbea004 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Fri, 14 Sep 2012 05:19:57 +0200 Subject: bin/get_comics: build new webpages after fetching new comics --- bin/get-comics | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/bin/get-comics b/bin/get-comics index 472344d..f959a6e 100755 --- a/bin/get-comics +++ b/bin/get-comics @@ -10,18 +10,35 @@ if [ "$1" = "" ]; then else daysago=$1 fi +myDate=$(date -Im --date "$daysago days ago") + top="$( cd "$(dirname "$0")/../" >/dev/null 2>&1 && pwd )" for update in ${top}/bin/comics/* ; do comic=$(basename $update) if [ "$output" = "true" ]; then - ${update} "${top}" "${daysago}" & + ${update} "${top}" "${daysago}" else - myDate=$(date -Im --date "$daysago days ago") echo "---------------- $myDate ----------------" >> ${top}/log/${comic}.log ${update} "${top}" "${daysago}" >> ${top}/log/${comic}.log 2>&1 & fi sleep 2 done + +# wait until all comics are fetched +wait + +# generate html pages +if [ "$output" = "true" ]; then + ${top}/bin/gen.py $daysago +else + echo "---------------- $myDate ----------------" >> ${top}/log/gen-html.log + ${top}/bin/gen.py "${daysago}" >> ${top}/log/gen-html.log 2>&1 +fi + +relativ_path="$(date +sites/%Y/%m/%d.html --date "$daysago days ago")" +if [ -f "${top}/htdocs/${relativ_path}" ]; then + ln -sf "${relativ_path}" "${top}/htdocs/index.html" +fi -- cgit v1.2.3-1-g7c22