summaryrefslogtreecommitdiffstats
path: root/bin/get-comics
blob: cc86ca14998fc75095c5c914971b654a5b68020a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh

if [ "$1" = "--output" ]; then
	output=true
	shift
fi

if [ "$1" = "" ]; then
	daysago=0
else
	daysago=$1
fi

myDate=$(date -Im --date "$daysago days ago")
dir="$(pwd)/$(dirname $0)/.."

find ${dir}/htdocs/imgs -maxdepth 2 -name 'get' -type f \
	-executable -printf '%h\n' | while read i ; do

	comic=$(basename $i)
	if [ "$output" = "true" ]; then
		${i}/get $daysago
	else
		echo "---------------- $myDate ----------------" >> ${dir}/log/${comic}.log
		${i}/get $daysago >> ${dir}/log/${comic}.log 2>&1 &
	fi

	sleep 2
done