summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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