From e1552eac0616725d908ee10964d9ea6b19ea4d78 Mon Sep 17 00:00:00 2001 From: Kasownik Date: Mon, 16 Jan 2017 20:20:57 +0100 Subject: [PATCH] Added error handling to fetch.sh --- fetch/fetch.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/fetch/fetch.sh b/fetch/fetch.sh index c4be25c..da46edf 100755 --- a/fetch/fetch.sh +++ b/fetch/fetch.sh @@ -4,8 +4,18 @@ K_FETCH_DIR="$K_DIR/fetch/" K_FETCH_LOG="$K_FETCH_DIR/fetch.log" K_FETCH_ENV="$K_FETCH_DIR/.env" +set -o pipefail + . $K_FETCH_ENV/bin/activate -echo "Fetch started." | ts >> "$K_FETCH_LOG" +echo "Fetch started." | ts | tee -a "$K_FETCH_LOG" -python "$K_FETCH_DIR/banking-ib.py" 2>&1 | ts | tee -a "$K_FETCH_LOG" +python -u "$K_FETCH_DIR/banking-ib.py" 2>&1 | ts | tee -a "$K_FETCH_LOG" +RET=$? + +if [ $RET -ne 0 ] +then + exit $RET +fi + +echo "Done." | ts | tee -a "$K_FETCH_LOG"