From 7b65fee25602e560749161e8a6d0ab1e3acda9bc Mon Sep 17 00:00:00 2001 From: Andrew Lorimer Date: Wed, 18 Jul 2018 00:15:49 +1000 Subject: [PATCH] fix bugs & add logging to nameget.sh --- nameget.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nameget.sh b/nameget.sh index c0088ab..4c19b8b 100755 --- a/nameget.sh +++ b/nameget.sh @@ -2,6 +2,7 @@ # get a list of urls and corresponding output file names, then parse them to wget +LOGTAG="nameget.sh" args=("$@") list=${args[0]} @@ -24,8 +25,13 @@ fi otherargs=$@ # set aside remaining arguments for passing to wget +logger -s -t $LOGTAG "starting downloading files in $list" + while read -r url filename tail; do - if wget --cut-dirs=100 -r -np -nc --accept -e robots=off -O "$outdir$filename" "$url" $otherargs + if wget --cut-dirs=100 -np --accept -e robots=off -O "$outdir$filename" "$url" $otherargs; then sed '/$filename/d' $list + logger -s -t $LOGTAG "downloaded $filename" + else + logger -s -t $LOGTAG "downloading of $filename from $url failed." fi done < $list -- 2.47.1