summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alex@spline.inf.fu-berlin.de>2012-09-14 05:19:57 +0200
committerroot <root@vm-staticweb.spline.inf.fu-berlin.de>2012-09-14 05:19:57 +0200
commit7a64425751a5b510443556dab2281d0d8dbea004 (patch)
tree71e5aaeb2b87d2c9f6ae82101af6f85ae6149a85
parenta158496fc5ed403fe7c7be5b6e968caf68fe4011 (diff)
downloadcomics-7a64425751a5b510443556dab2281d0d8dbea004.tar.gz
comics-7a64425751a5b510443556dab2281d0d8dbea004.tar.bz2
comics-7a64425751a5b510443556dab2281d0d8dbea004.zip
bin/get_comics: build new webpages after fetching new comics
-rwxr-xr-xbin/get-comics21
1 files 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