Error as warning only when falling back to stitching

This commit is contained in:
2024-08-13 15:31:47 -05:00
parent 082ffbb6e4
commit fd90883e79
2 changed files with 15 additions and 7 deletions

View File

@@ -17,7 +17,7 @@ jq -r '.[].Symbol' allSymbols.json | sort | while read theSymbol; do
#fi #fi
if [[ '$XSP' = ${theSymbol} ]]; then 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 if [[ $? -ne 0 ]]; then
systemd-cat -t "`basename $0`" -p warning <<< "falling back to stitching for ${theSymbol}" systemd-cat -t "`basename $0`" -p warning <<< "falling back to stitching for ${theSymbol}"
./recordOptionChainSingleSymbolSpecialRun.sh ${theSymbol} toDate $(date "+%Y-%m-%d" -d "+400 days") ./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 fi
if [[ '$SPX' = ${theSymbol} ]]; then 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 if [[ $? -ne 0 ]]; then
touch temp/hadErrors.$$.tmp touch temp/hadErrors.$$.tmp
fi fi
@@ -38,7 +38,7 @@ jq -r '.[].Symbol' allSymbols.json | sort | while read theSymbol; do
fi fi
#Default behavior - fall back to stitching on error #Default behavior - fall back to stitching on error
./recordOptionChainSingleSymbolSingleRun.sh ${theSymbol} ./recordOptionChainSingleSymbolSingleRun.sh -ErrorAsWarning ${theSymbol}
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
systemd-cat -t "`basename $0`" -p warning <<< "falling back to stitching for ${theSymbol}" systemd-cat -t "`basename $0`" -p warning <<< "falling back to stitching for ${theSymbol}"
./recordOptionChainSingleSymbolSpecialRun.sh ${theSymbol} ./recordOptionChainSingleSymbolSpecialRun.sh ${theSymbol}

View File

@@ -1,14 +1,22 @@
#!/bin/bash #!/bin/bash
#set -x #set -x
symbol=$1
outDir=data/$(date +%Y-%m-%d) outDir=data/$(date +%Y-%m-%d)
queryString="?symbol=${symbol}"
mkdir -p "${outDir}" mkdir -p "${outDir}"
mkdir -p temp mkdir -p temp
ErrorLogLevel=err
#Handle additional commandline parameters #Handle additional commandline parameters
if [[ $1 == -* ]]; then
if [[ $1 == "-ErrorAsWarning" ]]; then
ErrorLogLevel=warning
shift shift
fi
fi
symbol=$1
shift
queryString="?symbol=${symbol}"
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
queryString="${queryString}&$1=$2" queryString="${queryString}&$1=$2"
@@ -25,7 +33,7 @@ jqQuery=".symbol"
symbolCheck=$(jq -r ${jqQuery} < temp/optionChain.${symbol}.tmp.$$.json) symbolCheck=$(jq -r ${jqQuery} < temp/optionChain.${symbol}.tmp.$$.json)
if [[ "${symbol}" != "${symbolCheck}" ]]; then if [[ "${symbol}" != "${symbolCheck}" ]]; then
errMsg="ERROR: THE RESPONSE IS INCORRECT! Symbol: _${symbol}_ Check: _${symbolCheck}_ check file _temp/optionChain.${symbol}.tmp.$$.json_" 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}" >&2 echo "${errMsg}"
exit 2 exit 2
else else