From: Andrew Lorimer Date: Tue, 17 Jul 2018 14:15:49 +0000 (+1000) Subject: fix bugs & add logging to nameget.sh X-Git-Url: https://git.lorimer.id.au/scripts.git/diff_plain/7b65fee25602e560749161e8a6d0ab1e3acda9bc?ds=inline;hp=e534dcb996c14342f2cf4153dc81b66bb983bfd2 fix bugs & add logging to nameget.sh --- 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