Remove debug message and wrap more variables.

This commit is contained in:
Kevin Baensch 2022-12-24 19:48:31 +01:00
parent e30d950f88
commit 9083bfc5ad

View file

@ -60,14 +60,12 @@ disconnect() {
# $2 - target port # $2 - target port
port_forward() { port_forward() {
ACTIVE_HOST=$(cat $CONNECTION_CACHE) ACTIVE_HOST=$(cat $CONNECTION_CACHE)
if [ -z $ACTIVE_HOST ] || [ $ACTIVE_HOST != "$1:$2" ] if [ -z "${ACTIVE_HOST}" ] || [ "${ACTIVE_HOST}" != "$1:$2" ]
then then
if [ ! -z $ACTIVE_HOST ] if [ -n "${ACTIVE_HOST}" ]
then then
ssh -O cancel -L 6033:$ACTIVE_HOST -S $HOME/.ssh/controlmasters/%r@%h:%p ${SQL_PROXY_HOST} q ssh -O cancel -L 6033:${ACTIVE_HOST} -S ${HOME}/.ssh/controlmasters/%r@%h:%p ${SQL_PROXY_HOST} q
fi fi
echo $ACTIVE_HOST
echo $1 $2
ssh -O forward -L 6033:$1:$2 -S ${HOME}/.ssh/controlmasters/%r@%h:%p ${SQL_PROXY_HOST} ssh -O forward -L 6033:$1:$2 -S ${HOME}/.ssh/controlmasters/%r@%h:%p ${SQL_PROXY_HOST}
fi fi
echo "$1:$2" > "${CONNECTION_CACHE}" echo "$1:$2" > "${CONNECTION_CACHE}"