#!/bin/bash

# disabled...
exit

DISPL=$1
VNC_RESCALE=$2

export DISPLAY=:$DISPL

while [ true ]; do
  # kill old x11vnc running
  #for pid in `ps xa | grep x11vnc | grep rfbport | grep "\-display \:$DISPL" | grep -v grep | awk '{ print $1 }'`; do
  #  kill -9 $pid 2> /dev/null
  #done

  SCALED_PORT=`expr $DISPL + 5950`

  echo "Will start VNC: VNC_RESCALE: ${VNC_RESCALE}, DISPLAY ${DISPL}, PORT ${SCALED_PORT}" >> /tmp/vnc_stations.log

  /usr/bin/x11vnc -norc -scale ${VNC_RESCALE} -geometry ${VNC_RESCALE} -noxdamage -rfbport ${SCALED_PORT} -nowcr -noscr -display :${DISPL}
  sleep 2
done

