Cleanup - centralize the log handling
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
#!/bin/bash
|
||||
#set -x
|
||||
|
||||
systemd-cat -t "`basename $0`" -p info <<< "Started"
|
||||
. helpers.sh
|
||||
|
||||
log Started
|
||||
|
||||
./getNewAccessToken.sh
|
||||
if [[ $? -ne 0 ]]; then
|
||||
systemd-cat -t "`basename $0`" -p err <<< "Child process to get access token reported error. Exiting."
|
||||
exit 1
|
||||
log "Child process to get access token reported error. Exiting." err 1
|
||||
fi
|
||||
|
||||
jq -r '.[].Symbol' allSymbols.json | sort | while read theSymbol; do
|
||||
@@ -14,7 +15,7 @@ jq -r '.[].Symbol' allSymbols.json | sort | while read theSymbol; do
|
||||
if [[ '$XSP' = ${theSymbol} ]]; then
|
||||
./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}"
|
||||
log "falling back to stitching for ${theSymbol}" warning
|
||||
./recordOptionChainSingleSymbolSpecialRun.sh ${theSymbol} toDate $(date "+%Y-%m-%d" -d "+400 days")
|
||||
if [[ $? -ne 0 ]]; then
|
||||
touch temp/hadErrors.$$.tmp
|
||||
@@ -27,7 +28,7 @@ jq -r '.[].Symbol' allSymbols.json | sort | while read theSymbol; do
|
||||
#Default behavior - fall back to stitching on error
|
||||
./recordOptionChainSingleSymbolSingleRun.sh -ErrorAsWarning ${theSymbol}
|
||||
if [[ $? -ne 0 ]]; then
|
||||
systemd-cat -t "`basename $0`" -p warning <<< "falling back to stitching for ${theSymbol}"
|
||||
log "falling back to stitching for ${theSymbol}" warning
|
||||
./recordOptionChainSingleSymbolSpecialRun.sh ${theSymbol}
|
||||
if [[ $? -ne 0 ]]; then
|
||||
touch temp/hadErrors.$$.tmp
|
||||
@@ -40,4 +41,4 @@ if [[ -e temp/hadErrors.$$.tmp ]]; then
|
||||
curl -d "" -X POST "https://deadswitch.kawomi.com/api/v1?topic=trade.schwab.error.recordAllSymbolsSingleRun&secs=1&email=joe@kawomi.com"
|
||||
fi
|
||||
|
||||
systemd-cat -t "`basename $0`" -p info <<< "Finished"
|
||||
log "Finished"
|
||||
|
||||
Reference in New Issue
Block a user