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
port_forward() {
ACTIVE_HOST=$(cat $CONNECTION_CACHE)
if [ -z $ACTIVE_HOST ] || [ $ACTIVE_HOST != "$1:$2" ]
if [ -z "${ACTIVE_HOST}" ] || [ "${ACTIVE_HOST}" != "$1:$2" ]
then
if [ ! -z $ACTIVE_HOST ]
if [ -n "${ACTIVE_HOST}" ]
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
echo $ACTIVE_HOST
echo $1 $2
ssh -O forward -L 6033:$1:$2 -S ${HOME}/.ssh/controlmasters/%r@%h:%p ${SQL_PROXY_HOST}
fi
echo "$1:$2" > "${CONNECTION_CACHE}"