From b3f8b6aa05ac1d5491f2c59ba6a5d1717909ccc6 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Fri, 10 May 2024 13:46:14 -0700 Subject: [PATCH] cron: prevent blank files --- scripts/cron-status.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/cron-status.sh b/scripts/cron-status.sh index 2914a83..22046cf 100755 --- a/scripts/cron-status.sh +++ b/scripts/cron-status.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -e + # Change directory to the root of the project cd "$(dirname "${BASH_SOURCE[0]}")"/.. @@ -7,7 +9,8 @@ cd "$(dirname "${BASH_SOURCE[0]}")"/.. source .env # Save status to file server -python3 framework/status-json.py > dist/file-server/status.json +STATUS=$(python3 framework/status-json.py) +echo -e "$STATUS" > dist/file-server/status.json # Done echo -e "Status updated at $(date)" @@ -16,5 +19,7 @@ echo -e "Status updated at $(date)" if [[ -n "$COLLECT_STATUS_GLOBAL" ]]; then echo -e "Waiting before starting global status job ..." sleep 60 - python3 framework/status-global.py > dist/file-server/status-global.json + + GLOBAL_STATUS=$(python3 framework/status-global.py) + echo -e "$GLOBAL_STATUS" > dist/file-server/status-global.json fi