diff --git a/recordAllSymbolsSingleRun.sh b/recordAllSymbolsSingleRun.sh index 86abbac..88132f3 100755 --- a/recordAllSymbolsSingleRun.sh +++ b/recordAllSymbolsSingleRun.sh @@ -17,7 +17,7 @@ jq -r '.[].Symbol' allSymbols.json | sort | while read theSymbol; do #fi if [[ '$XSP' = ${theSymbol} ]]; then - ./recordOptionChainSingleSymbolSingleRun.sh ${theSymbol} toDate $(date "+%Y-%m-%d" -d "+400 days") + ./recordOptionChainSingleSymbolSingleRun.sh -ErrorAsWarning ${theSymbol} toDate $(date "+%Y-%m-%d" -d "+400 days") if [[ $? -ne 0 ]]; then systemd-cat -t "`basename $0`" -p warning <<< "falling back to stitching for ${theSymbol}" ./recordOptionChainSingleSymbolSpecialRun.sh ${theSymbol} toDate $(date "+%Y-%m-%d" -d "+400 days") @@ -30,7 +30,7 @@ jq -r '.[].Symbol' allSymbols.json | sort | while read theSymbol; do fi if [[ '$SPX' = ${theSymbol} ]]; then - ./recordOptionChainSingleSymbolSingleRun.sh ${theSymbol} fromDate $(date "+%Y-%m-%d" -d "+40 days") toDate $(date "+%Y-%m-%d" -d "+46 days") + ./recordOptionChainSingleSymbolSingleRun.sh -ErrorAsWarning ${theSymbol} fromDate $(date "+%Y-%m-%d" -d "+40 days") toDate $(date "+%Y-%m-%d" -d "+46 days") if [[ $? -ne 0 ]]; then touch temp/hadErrors.$$.tmp fi @@ -38,7 +38,7 @@ jq -r '.[].Symbol' allSymbols.json | sort | while read theSymbol; do fi #Default behavior - fall back to stitching on error - ./recordOptionChainSingleSymbolSingleRun.sh ${theSymbol} + ./recordOptionChainSingleSymbolSingleRun.sh -ErrorAsWarning ${theSymbol} if [[ $? -ne 0 ]]; then systemd-cat -t "`basename $0`" -p warning <<< "falling back to stitching for ${theSymbol}" ./recordOptionChainSingleSymbolSpecialRun.sh ${theSymbol} diff --git a/recordOptionChainSingleSymbolSingleRun.sh b/recordOptionChainSingleSymbolSingleRun.sh index 66071d2..0701706 100755 --- a/recordOptionChainSingleSymbolSingleRun.sh +++ b/recordOptionChainSingleSymbolSingleRun.sh @@ -1,15 +1,23 @@ #!/bin/bash #set -x -symbol=$1 outDir=data/$(date +%Y-%m-%d) -queryString="?symbol=${symbol}" - mkdir -p "${outDir}" mkdir -p temp +ErrorLogLevel=err #Handle additional commandline parameters +if [[ $1 == -* ]]; then + if [[ $1 == "-ErrorAsWarning" ]]; then + ErrorLogLevel=warning + shift + fi +fi + +symbol=$1 shift +queryString="?symbol=${symbol}" + while [[ $# -gt 0 ]]; do queryString="${queryString}&$1=$2" shift; shift @@ -25,7 +33,7 @@ jqQuery=".symbol" symbolCheck=$(jq -r ${jqQuery} < temp/optionChain.${symbol}.tmp.$$.json) if [[ "${symbol}" != "${symbolCheck}" ]]; then errMsg="ERROR: THE RESPONSE IS INCORRECT! Symbol: _${symbol}_ Check: _${symbolCheck}_ check file _temp/optionChain.${symbol}.tmp.$$.json_" - systemd-cat -t "`basename $0` $1" -p err <<< ${errMsg} + systemd-cat -t "`basename $0` $1" -p ${ErrorLogLevel} <<< ${errMsg} >&2 echo "${errMsg}" exit 2 else