From 5f6d1ec9b301894e012212355eecd113ab4c0c05 Mon Sep 17 00:00:00 2001 From: Rub21 Date: Fri, 5 Apr 2024 17:19:21 -0500 Subject: [PATCH] Updata start taginfo script --- images/taginfo/start.sh | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/images/taginfo/start.sh b/images/taginfo/start.sh index 37a50f02..79405dca 100755 --- a/images/taginfo/start.sh +++ b/images/taginfo/start.sh @@ -86,26 +86,23 @@ update() { } start_web() { - echo "Start...Taginfo web service" - cd $WORKDIR/taginfo/web && bundle exec rackup --host 0.0.0.0 -p 80 -} - -continuous_update() { while true; do - update - sleep $TIME_UPDATE_INTERVAL + echo "Start...Taginfo web service" + NUM_DB_FILES=$(ls $DATA_DIR/*.db | wc -l) + if [ $NUM_DB_FILES -ge 7 ]; then + cd /apps/taginfo/web && bundle exec rackup --host 0.0.0.0 -p 80 & + break + fi + sleep 60 done } -main() { + +ACTION=$1 +if [ "$ACTION" = "web" ]; then + start_web +elif [ "$ACTION" = "data" ]; then set_taginfo_config updates_source_code - # Check if db files are store in the $DATA_DIR in order to start the service or start procesing the file - NUM_DB_FILES=$(ls $DATA_DIR/*.db | wc -l) - if [ $NUM_DB_FILES -lt 7 ]; then - update - fi - start_web & - continuous_update -} -main + update +fi