From: Silvio Rhatto Date: Sun, 2 Aug 2015 19:29:23 +0000 (-0300) Subject: Correctly check if URL was downloaded X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=1a627790377ef0f75c53d20a7f7b31cb44306b41;p=httruta.git Correctly check if URL was downloaded --- 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