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