#!/bin/sh

#/**************************************************************************/
#/*                                                                        */
#/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/.         */
#/*                                                                        */
#/* NXSCRIPTS, NX protocol compression and NX extensions to this software  */
#/* are copyright of NoMachine. Redistribution and use of the present      */
#/* software is allowed according to terms specified in the file LICENSE   */
#/* which comes in the source distribution.                                */
#/*                                                                        */
#/* Check http://www.nomachine.com/licensing.html for applicability.       */
#/*                                                                        */
#/* NX and NoMachine are trademarks of Medialogic S.p.A.                   */
#/*                                                                        */
#/* All rights reserved.                                                   */
#/*                                                                        */
#/**************************************************************************/

#set -x

cd ${HOME}/NX

NX_PORT=9
export NX_PORT

NX_ROOT=${HOME}/.nx

LD_LIBRARY_PATH="${HOME}/NX/nxcomp"
export LD_LIBRARY_PATH

PATH="${PATH}:${HOME}/NX/nxclient/nxclient:/usr/NX/bin:/opt/NX/bin"
export PATH

COOKIE=123efa980d2cba234ef6f73deac810ff

rm -rf ${HOME}/.nx/S-${NX_PORT} || exit
mkdir -p ${HOME}/.nx/S-${NX_PORT} || exit

nxproxy/nxproxy -S  nx/nx,connect=localhost,cookie=${COOKIE}:${NX_PORT} 2>>${HOME}/.nx/S-${NX_PORT}/session &

echo ""


