From b28fc78cfda857ee27d4a096b0792df8d56ae3df Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Thu, 15 Jun 2023 10:48:00 +0300 Subject: [PATCH] home/wm: ignore curl errors --- home/modules/window_manager/scripts/exchangerate.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/home/modules/window_manager/scripts/exchangerate.sh b/home/modules/window_manager/scripts/exchangerate.sh index ab9fc5d..659e8b3 100755 --- a/home/modules/window_manager/scripts/exchangerate.sh +++ b/home/modules/window_manager/scripts/exchangerate.sh @@ -2,12 +2,14 @@ set -e +curl_opts=(--silent --connect-timeout 1 --no-progress-meter -X GET) + curl_cbr () { local today=$(date +%d/%m/%Y) local start_range=$(date +%d/%m/%Y -d '-14 day') local usd=R01235 - curl --no-progress-meter "https://www.cbr.ru/scripts/XML_dynamic.asp?date_req1=$start_range&date_req2=$today&VAL_NM_RQ=$usd" | \ + curl ${curl_opts[@]} "https://www.cbr.ru/scripts/XML_dynamic.asp?date_req1=$start_range&date_req2=$today&VAL_NM_RQ=$usd" | \ sed -e "s/<[A-Z]/\n\0/g" | \ grep Value | \ sed -e "s#<\/\?\w\+>##g" | \ @@ -18,7 +20,7 @@ curl_exchangerate () { local start_date=$(date +%Y-%m-%d -d '-1 day') local end_date=$(date +%Y-%m-%d) - curl --no-progress-meter -X GET "https://api.exchangerate.host/timeseries?start_date=$start_date&end_date=$end_date&base=USD&symbols=RUB&places=4&format=xml" | \ + curl ${curl_opts[@]} "https://api.exchangerate.host/timeseries?start_date=$start_date&end_date=$end_date&base=USD&symbols=RUB&places=4&format=xml" | \ sed -e "s/<[a-z]/\n\0/g" | \ grep rate | \ sed -e "s#<\/\?\w\+>##g"