Skip to content

Commit

Permalink
cron: prevent blank files
Browse files Browse the repository at this point in the history
  • Loading branch information
pulsejet committed May 10, 2024
1 parent 151f31d commit b3f8b6a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions scripts/cron-status.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
#!/bin/bash

set -e

# Change directory to the root of the project
cd "$(dirname "${BASH_SOURCE[0]}")"/..

# Get variables in shell
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)"
Expand All @@ -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

0 comments on commit b3f8b6a

Please sign in to comment.