Skip to content

Commit

Permalink
Fix read non-existent file bug
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusroemer committed Sep 11, 2024
1 parent 679ec99 commit 2c7d993
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions kubernetes/loculus/silo_import_job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,18 @@ preprocessing() {
update_snapshot_time
}

filecontent_or_zero() {
if [ -f "$1" ]; then
cat "$1"
else
echo 0
fi
}

update_snapshot_time() {
echo "Updating snapshot times"
new_snapshot_time=$(cat "$new_snapshot_time_path")
old_snapshot_time=$(cat "$current_snapshot_time_path")
new_snapshot_time=$(filecontent_or_zero "$new_snapshot_time_path")
old_snapshot_time=$(filecontent_or_zero "$current_snapshot_time_path")
echo "Updating snapshot time from $old_snapshot_time to $new_snapshot_time"
cp "$new_snapshot_time_path" "$current_snapshot_time_path"
}
Expand Down

0 comments on commit 2c7d993

Please sign in to comment.