Adding check for existing ssh tunnel
This commit is contained in:
parent
942522458f
commit
6668e1af4f
|
|
@ -29,10 +29,14 @@ else
|
||||||
SSH_PORT=13308
|
SSH_PORT=13308
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create SSH tunnel
|
# Create SSH tunnel if not already running
|
||||||
|
if ! lsof -ti:$SSH_PORT > /dev/null 2>&1; then
|
||||||
echo "Creating SSH tunnel to $TARGET database on localhost:$SSH_PORT..."
|
echo "Creating SSH tunnel to $TARGET database on localhost:$SSH_PORT..."
|
||||||
ssh -f -N -L $SSH_PORT:localhost:$DB_PORT cmc
|
ssh -f -N -L $SSH_PORT:localhost:$DB_PORT cmc
|
||||||
sleep 2
|
sleep 2
|
||||||
|
else
|
||||||
|
echo "SSH tunnel already exists on localhost:$SSH_PORT, reusing it..."
|
||||||
|
fi
|
||||||
|
|
||||||
# Load goose.env and override the port
|
# Load goose.env and override the port
|
||||||
GOOSE_ENV_FILE="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../go" && pwd)/goose.env"
|
GOOSE_ENV_FILE="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../go" && pwd)/goose.env"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue