From 32c5ba2caaf31e38fe091363936b6093d819c744 Mon Sep 17 00:00:00 2001 From: olli Date: Tue, 13 Feb 2024 16:46:05 +0100 Subject: [PATCH] added wget timeout opts --- dabo/analyze.sh | 2 +- dabo/dabo-bot.sh | 2 ++ dabo/functions/get_marketdata.sh | 8 ++++---- dabo/functions/webpage.sh | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/dabo/analyze.sh b/dabo/analyze.sh index 4061310..4142dfe 100755 --- a/dabo/analyze.sh +++ b/dabo/analyze.sh @@ -248,7 +248,7 @@ cp -r strategies analyze-${analyzedate}/ analyzecounter=0 ## Chart Part -#[ -e data/charts.min.css ] || wget -q https://raw.githubusercontent.com/ChartsCSS/charts.css/main/dist/charts.min.css -O data/charts.min.css +#[ -e data/charts.min.css ] || wget ${g_wget_opts} -q https://raw.githubusercontent.com/ChartsCSS/charts.css/main/dist/charts.min.css -O data/charts.min.css ## Chart Part End for file in $@ diff --git a/dabo/dabo-bot.sh b/dabo/dabo-bot.sh index 29e4083..74fc7ce 100755 --- a/dabo/dabo-bot.sh +++ b/dabo/dabo-bot.sh @@ -10,6 +10,8 @@ BASEPATH=/dabo/htdocs g_tries=13 g_tries_delay=23 +g_wget_opts="--timeout 10 --tries=2" + ### FUNCTIONS ### for bashfunc in $(find ${BASEPATH}/../functions -type f -name "*.sh") do diff --git a/dabo/functions/get_marketdata.sh b/dabo/functions/get_marketdata.sh index 5162517..a0215a2 100644 --- a/dabo/functions/get_marketdata.sh +++ b/dabo/functions/get_marketdata.sh @@ -35,10 +35,10 @@ function get_marketdata_from_url { # check source platform for parsing parameters, prepare and run wget command >MARKET_DATA_CMD - echo ${f_url} | grep -q "boerse.de" && echo "wget -q -O - ${f_url} | egrep 'itemprop=\"price\" content=\"[0-9]+\.[0-9]+\"' | sed s'#\"#\n#g' | egrep '^[0-9]+\.[0-9]+'" >MARKET_DATA_CMD - echo ${f_url} | egrep -q "investing.com.+economic-calendar" && echo "wget -q -O - ${f_url} | egrep 'Actual.+Forecast.+Previous' | cut -d'>' -f7,11 | cut -d'<' -f1,2 | sed 's#,##g' | sed 's#\%##g' | sed 's##,#' | grep '[0-9]'" >MARKET_DATA_CMD - echo ${f_url} | egrep -q "investing.com.+indices" && echo "wget -q -O - ${f_url} | sed 's##\n#g' | grep 'text-5xl.*font-bold.*md:text-' | sed 's#^.*>##; s#,##g' | grep '[0-9]'" >MARKET_DATA_CMD - [ -s MARKET_DATA_CMD ] || echo "wget -q -O - ${f_url}" >MARKET_DATA_CMD + echo ${f_url} | grep -q "boerse.de" && echo "wget ${g_wget_opts} -q -O - ${f_url} | egrep 'itemprop=\"price\" content=\"[0-9]+\.[0-9]+\"' | sed s'#\"#\n#g' | egrep '^[0-9]+\.[0-9]+'" >MARKET_DATA_CMD + echo ${f_url} | egrep -q "investing.com.+economic-calendar" && echo "wget ${g_wget_opts} -q -O - ${f_url} | egrep 'Actual.+Forecast.+Previous' | cut -d'>' -f7,11 | cut -d'<' -f1,2 | sed 's#,##g' | sed 's#\%##g' | sed 's##,#' | grep '[0-9]'" >MARKET_DATA_CMD + echo ${f_url} | egrep -q "investing.com.+indices" && echo "wget ${g_wget_opts} -q -O - ${f_url} | sed 's##\n#g' | grep 'text-5xl.*font-bold.*md:text-' | sed 's#^.*>##; s#,##g' | grep '[0-9]'" >MARKET_DATA_CMD + [ -s MARKET_DATA_CMD ] || echo "wget ${g_wget_opts} -q -O - ${f_url}" >MARKET_DATA_CMD g_runcmd g_retrycmd sh MARKET_DATA_CMD >MARKET_DATA_CMD_OUT-${f_name}.tmp 2>MARKET_DATA_CMD_OUT-${f_name}.tmp.err diff --git a/dabo/functions/webpage.sh b/dabo/functions/webpage.sh index 38bf57f..2fa5243 100644 --- a/dabo/functions/webpage.sh +++ b/dabo/functions/webpage.sh @@ -4,7 +4,7 @@ function webpage { g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" # Get charts.css - [ -e ../charts.min.css ] || wget -q https://raw.githubusercontent.com/ChartsCSS/charts.css/main/dist/charts.min.css -O ../charts.min.css + [ -e ../charts.min.css ] || wget ${g_wget_opts} -q https://raw.githubusercontent.com/ChartsCSS/charts.css/main/dist/charts.min.css -O ../charts.min.css # create status webpage echo "