From f627125c0fa9fdcc4a0650ab3626330a16e992a8 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Thu, 10 May 2012 02:13:27 +0000 Subject: bin/comics: add script for updating xkcd, add $state_file config xkcd is special (read: other than all others scripts) because it does not contain a timestamp information in the comics. we have to track the last script that was added to our mirror. so the xkcd script needs a state-file containing the last xkcd that was mirrored. the date of the xkcd is the day of the first discovery of a new comic. --- etc/settings.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'etc') diff --git a/etc/settings.sh b/etc/settings.sh index d1f5486..d837e7d 100644 --- a/etc/settings.sh +++ b/etc/settings.sh @@ -11,7 +11,11 @@ comic=$(basename $0) year=$(date -d"$daysago days ago" +%Y) month=$(date -d"$daysago days ago" +%Y-%m) day=$(date -d"$daysago days ago" +%d) -comic_dir=$(pwd)/$(dirname $0)/../../htdocs/imgs/${comic} + +top="$(pwd)/$(dirname $0)/../../" +state_dir=${top}/var/state/ +state_file=${state_dir}/${comic}.state +comic_dir=${top}/htdocs/imgs/${comic} image_offset=${month}/ image_dir=${comic_dir}/${image_offset} @@ -19,4 +23,8 @@ if [ ! -d "${image_dir}" ]; then mkdir -p "${image_dir}" fi +if [ ! -d "${state_dir}" ]; then + mkdir -p "${state_dir}" +fi + wget_args="--timeout 100 --wait=1000 --no-cache" -- cgit v1.2.3-1-g7c22