From 676e7ac3abb5eb9d956a702adec2a21b97cb4ed6 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Fri, 27 Jul 2012 14:37:51 +0200 Subject: bin: supply top directory to fetch scripts If calling get-commics with absolute pathe the fetching scripts got something like /var/www/comics.spline.de//var/www/comics.spline.de/ as absolute path. This fixes this issue by changing the working directory to the top level directory and getting the path with $(pwd) one time and supply the top directory to the fetching scripts as first argument. --- bin/get-comics | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'bin/get-comics') diff --git a/bin/get-comics b/bin/get-comics index 73f6d39..472344d 100755 --- a/bin/get-comics +++ b/bin/get-comics @@ -11,16 +11,16 @@ else daysago=$1 fi -top="$(pwd)/$(dirname $0)/../" -for update in comics/* ; do +top="$( cd "$(dirname "$0")/../" >/dev/null 2>&1 && pwd )" +for update in ${top}/bin/comics/* ; do comic=$(basename $update) if [ "$output" = "true" ]; then - ${update} $daysago & + ${update} "${top}" "${daysago}" & else myDate=$(date -Im --date "$daysago days ago") echo "---------------- $myDate ----------------" >> ${top}/log/${comic}.log - ${update} $daysago >> ${top}/log/${comic}.log 2>&1 & + ${update} "${top}" "${daysago}" >> ${top}/log/${comic}.log 2>&1 & fi sleep 2 -- cgit v1.2.3-1-g7c22