From f63497ac860cb389b0afc27e420f95129dc3ea05 Mon Sep 17 00:00:00 2001 From: Andrew Lorimer Date: Mon, 24 Dec 2018 15:21:54 +1100 Subject: [PATCH] optional destination file, verbose debugging for wget in syslog --- nameget.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nameget.sh b/nameget.sh index edc1e2e..b083568 100755 --- a/nameget.sh +++ b/nameget.sh @@ -28,11 +28,15 @@ otherargs=$@ # set aside remaining arguments for passing to wget logger -s -t $LOGTAG "starting downloading files in $list" while read -r url filename; do - if wget --cut-dirs=100 -np -e robots=off -O $outdir$filename $otherargs $url; then + destarg = '' + if [ -n "$filename" ]; then + $destarg = " -O $outdir$filename" + + if output=$(wget --cut-dirs=100 -np -e robots=off -P $outdir$destarg $otherargs $url); then sed -i "/$filename/d" $list echo $filename logger -s -t $LOGTAG "downloaded $filename" else - logger -s -t $LOGTAG "downloading of $filename from $url failed." + logger -s -t $LOGTAG "downloading of $filename from $url failed: $output" fi done < $list -- 2.43.2