From f87554d0d0406978c7ddeaf230bc2c6384e2b426 Mon Sep 17 00:00:00 2001 From: PhilipWafula Date: Wed, 20 Oct 2021 15:52:59 +0300 Subject: [PATCH] Add better output and minor fixes. --- apps/data-seeding/import_ussd.sh | 50 ++++++++++++++++---------------- 1 file changed, 25 insertions(+), 25 deletions(-) mode change 100644 => 100755 apps/data-seeding/import_ussd.sh diff --git a/apps/data-seeding/import_ussd.sh b/apps/data-seeding/import_ussd.sh old mode 100644 new mode 100755 index 1eb7e3f6..67f1292e --- a/apps/data-seeding/import_ussd.sh +++ b/apps/data-seeding/import_ussd.sh @@ -2,11 +2,11 @@ if [[ -d "$OUT_DIR" ]] then - echo "found existing IMPORT DIR cleaning up..." + echo -e "\033[;96mfound existing IMPORT DIR cleaning up...\033[;96m" rm -rf "$OUT_DIR" mkdir -p "$OUT_DIR" else - echo "IMPORT DIR does not exist creating it." + echo -e "\033[;96mIMPORT DIR does not exist creating it.\033[;96m" mkdir -p "$OUT_DIR" fi @@ -14,81 +14,81 @@ fi timeout 5 celery inspect ping -b "$CELERY_BROKER_URL" if [[ $? -eq 124 ]] then - >&2 echo "Celery workers not available. Is the CELERY_BROKER_URL ($CELERY_BROKER_URL) correct?" + >&2 echo -e "\033[;96mCelery workers not available. Is the CELERY_BROKER_URL ($CELERY_BROKER_URL) correct?\033[;96m" exit 1 fi -echo "Creating seed data..." +echo -e "\033[;96mCreating seed data...\033[;96m" python create_import_users.py -vv -c "$CONFIG" --dir "$OUT_DIR" "$NUMBER_OF_USERS" wait $! -echo "Check for running celery workers ..." +echo -e "\033[;96mCheck for running celery workers ...\033[;96m" if [ -f ./cic-ussd-import.pid ]; then - echo "Found a running worker. Killing ..." + echo -e "\033[;96mFound a running worker. Killing ...\033[;96m" kill -9 $( nohup.out 2> nohup.err < /dev/null & else - echo "Running worker with opening balance transactions" + echo -e "\033[;96mRunning worker with opening balance transactions\033[;96m" TARGET_TX_COUNT=$((NUMBER_OF_USERS*2)) nohup python cic_ussd/import_balance.py -vv -c "$CONFIG" -p "$ETH_PROVIDER" -r "$CIC_REGISTRY_ADDRESS" --include-balances --token-symbol "$TOKEN_SYMBOL" -y "$KEYSTORE_PATH" "$OUT_DIR" & fi -echo "Target count set to ${TARGET_TX_COUNT}" +echo -e "\033[;96mTarget count set to ${TARGET_TX_COUNT}" until [ -f ./cic-import-ussd.pid ] do - echo "Polling for celery worker pid file..." + echo -e "\033[;96mPolling for celery worker pid file...\033[;96m" sleep 1 done IMPORT_BALANCE_JOB=$(