#!/bin/sh
# This will attempt a unsecure connection to a remote ssh server, you're warned.
# It'll ignore unknown and invalid user hostkeys, you can still use global hostkeys.
. /etc/ltsp/nxloadbalancer.conf

# defaults
PORT=${PORT:-"8008"}
TIMEOUT=${TIMEOUT:-"10"}
URL="http://$SERVER:$PORT/"

if [ -n "$LBGROUP" ]; then
    URL="$URL?group=$LBGROUP"
fi

NXSERVER=$(wget -q -O - --timeout=$TIMEOUT -t 1 $URL)
ssh -o StrictHostKeyChecking=no nx@$NXSERVER
