extras/cloudsql/populate-jobs/populate-accounts-db.yaml [21:57]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
data:
  wait-to-complete-sidecar.sh: |
    #!/bin/bash
    COUNTER=0
    TARGET=$1
    PROCESS=$2

    echo "Looking for $TARGET"

    sleep 10s # Give 10s to allow processes to start

    # 20 minutes (60 x 10s increments)
    while [ $COUNTER -lt 120 ]; do
        let COUNTER=$COUNTER+1

        IS_RUNNING=$(ps -A | grep "scripts/$TARGET" | grep -v grep)

        if [ "$IS_RUNNING" != "" ]; then
          echo "Attempt # ${COUNTER}: Process not completed, trying again in 10 seconds -- ${IS_RUNNING}"
          sleep 10s
        else
          echo "'${TARGET}' Process Finished, Stopping '${PROCESS}'"
          killall ${PROCESS}
          exit 0
        fi
    done

    echo "Could not determine if the import finished, killing the proxy"
    killall ${PROCESS}
    exit 0

  initialize-database.sh: |
    #!/bin/bash

    COUNTER=0
    SLEEP_TIME=60 # 1 minute
    DB_READY=0 # false
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



extras/cloudsql/populate-jobs/populate-ledger-db.yaml [21:57]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
data:
  wait-to-complete-sidecar.sh: |
    #!/bin/bash
    COUNTER=0
    TARGET=$1
    PROCESS=$2

    echo "Looking for $TARGET"

    sleep 10s # Give 10s to allow processes to start

    # 20 minutes (60 x 10s increments)
    while [ $COUNTER -lt 120 ]; do
        let COUNTER=$COUNTER+1

        IS_RUNNING=$(ps -A | grep "scripts/$TARGET" | grep -v grep)

        if [ "$IS_RUNNING" != "" ]; then
          echo "Attempt # ${COUNTER}: Process not completed, trying again in 10 seconds -- ${IS_RUNNING}"
          sleep 10s
        else
          echo "'${TARGET}' Process Finished, Stopping '${PROCESS}'"
          killall ${PROCESS}
          exit 0
        fi
    done

    echo "Could not determine if the import finished, killing the proxy"
    killall ${PROCESS}
    exit 0

  initialize-database.sh: |
    #!/bin/bash

    COUNTER=0
    SLEEP_TIME=60 # 1 minute
    DB_READY=0 # false
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



