From 1a627790377ef0f75c53d20a7f7b31cb44306b41 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 2 Aug 2015 16:29:23 -0300 Subject: Correctly check if URL was downloaded --- lib/httracker/functions | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/httracker/functions b/lib/httracker/functions index 56db0f6..f43dae7 100644 --- a/lib/httracker/functions +++ b/lib/httracker/functions @@ -45,6 +45,9 @@ function httracker_get { # Basic options httracker_opts + # Log options + OPTS="$OPTS --file-log $LOG" + # Additional options if [ "`whoami`" == "root" ]; then OPTS="$OPTS --user $USER" @@ -57,13 +60,7 @@ function httracker_get { fi # Get each URL - httrack ${OPTS} ${url} | tee $LOG - - # Fix permissions again - if [ "`whoami`" != "$USER" ] && [ "`whoami`" == "root" ]; then - echo "Fixing $TARGET permissions again..." - chown -R $USER.$GROUP $TARGET/ - fi + httrack ${OPTS} ${url} if [ "$?" == "0" ]; then # Mark as downloaded @@ -72,6 +69,12 @@ function httracker_get { echo "Error fetching $url." rm -rf $TARGET fi + + # Fix permissions again + if [ "`whoami`" != "$USER" ] && [ "`whoami`" == "root" ]; then + echo "Fixing $TARGET permissions again..." + chown -R $USER.$GROUP $TARGET/ + fi } # Download URLs, incremental mode -- cgit v1.2.3