This already works if you don't use the -s switch to vglconnect. Why it's failing with -s is that -s causes vglconnect to run vgllogin on the server, so any additional arguments are interpreted as SSH options instead of as a remote command. I added a new vglconnect option, per your suggestion, that allows you to specify a program to run on the server:

e.g.
vglconnect -s -C -e 'vglrun /opt/VirtualGL/bin/glxspheres64' myserver

New script is attached. Let me know if it works, and if so, I'll check it in.


On 8/5/15 6:43 AM, DRC wrote:
I don't think it would be very difficult to add that functionality, given that 
vglconnect is basically just a wrapper for SSH. Let me look at it further and 
get back to you.

On Aug 5, 2015, at 3:15 AM, Heiko Klein <heiko.kl...@met.no> wrote:

Hi,

we're currently successfully using vgl to start our applications like:

myclient$ vglconnect -s -C myserver
myserver$ vglrun glprog


We cannot sell our users a program which requires using the
command-line, so we need to create a startup button. Thus we need a
non-interactive startup of 'vglrun glprog', e.g. (not working!)

myclient$ vglconnect -s -C myserver vglrun glprog



Does there exist a vgl-program/option which allows starting
vglconnect/vglrun from the client-machine?


If not, is there some interest to add that functionality, e.g.

myclient$ vglconnect -s -C  -E 'glprog' myserver


(I checked the vglconnect/vgllogins skript and it doesn't seem to hard
to add these parameters, so I could volunteer.)


Best regards,

Heiko

#!/bin/sh

# Copyright (C)2007 Sun Microsystems, Inc.
# Copyright (C)2009-2011, 2014-2015 D. R. Commander
#
# This library is free software and may be redistributed and/or modified under
# the terms of the wxWindows Library License, Version 3.1 or (at your option)
# any later version.  The full license is in the LICENSE.txt file included
# with this distribution.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# wxWindows Library License for more details.

maketemp()
{
        umask 077
        mktemp /tmp/$1.XXXXXX || exit 1
}

VGLTUNNEL=0
X11TUNNEL=1
CONNECT=1
FORCE=0
SSHCMD=ssh

usage()
{
        echo
        echo "USAGE: $0"
        echo "       [vglconnect options] [user@]hostname [Additional SSH 
options]"
        echo
        echo "vglconnect options:"
        echo "-display <d> = Local X display to use when drawing VirtualGL's 
images"
        echo "               (default: read from DISPLAY environment variable)"
        echo "-s = Tunnel VGL Transport and X11 through SSH (default: tunnel 
only X11)"
        echo "-e {program} = When using -s, execute {program} on the server 
after"
        echo "               running vgllogin"
        echo "-x = Do not tunnel X11 or the VGL Transport, but create an xauth 
key"
        echo "     and add it to the VirtualGL server's keyring so that the 
VirtualGL"
        echo "     server (and any that share its home directory) can use this 
X display"
        echo "-k = Do not connect to server, but create an xauth key for this X 
display and"
        echo "     add it to the local keyring so that any VirtualGL servers 
that share the"
        echo "     same home directory as this machine can use this X display"
        echo "-g = Use gsissh from Globus Toolkit to make all SSH connections"
        echo "-force = Force a new vglclient instance (use with caution)"
        echo "-bindir <d> = Path in which the VGL executables and scripts are 
installed on"
        echo "              the server machine (default: /opt/VirtualGL/bin).  
Can also be"
        echo "              set with the VGL_BINDIR environment variable on the 
client"
        echo "              machine."
        echo
        exit $1
}

if [ -z $VGL_BINDIR ]; then
        VGL_BINDIR=/opt/VirtualGL/bin
fi

while [ $# -gt 0 ]
do
        case "$1" in
        -d*) DISPLAY=$2; shift ;;
        -b*) VGL_BINDIR=$2; shift ;;
        -f*) FORCE=1 ;;
        -s*) X11TUNNEL=1; VGLTUNNEL=1; CONNECT=1 ;;
        -x*) X11TUNNEL=0; VGLTUNNEL=0; CONNECT=1 ;;
        -k*) X11TUNNEL=0; VGLTUNNEL=0; CONNECT=0 ;;
        -g*) SSHCMD=gsissh; GLOBUS=1 ;;
        -e*) COMMAND=$2; shift ;;
        *) break ;;
        esac
        shift
done

if [ $# -eq 0 -a $CONNECT -eq 1 ]; then
        usage 0
fi

if [ "$DISPLAY" = "" ]; then
        echo "[VGL] ERROR: An X display must be specified, either by using the 
-display"
        echo "[VGL]    argument to vglconnect or by setting the DISPLAY 
environment variable"
        exit 1
fi

LOGDIR=$HOME/.vgl
if [ ! -d $LOGDIR ]; then mkdir $LOGDIR; fi
LOGDISPLAY=`basename $DISPLAY`
LOGFILE=$LOGDIR/vglconnect-$HOSTNAME-$LOGDISPLAY.log

VGLARGS="-l "$LOGFILE" -d "$DISPLAY" -detach"
if [ "$FORCE" = "1" ]; then VGLARGS=$VGLARGS" -force"; fi
if [ ! "$VGL_PORT" = "" -a "$__VGL_SSHTUNNEL" = "1" ]; then
        PORT=$VGL_PORT
else
        VGLCLIENT=`dirname $0`/vglclient
        if [ ! -x $VGLCLIENT ]; then
                if [ -x /opt/VirtualGL/bin/vglclient ]; then
                        VGLCLIENT=/opt/VirtualGL/bin/vglclient
                else
                        VGLCLIENT=vglclient
                fi
        fi
        PORT=`$VGLCLIENT $VGLARGS`
        if [ $? -ne 0 -o "$PORT" = "" ]; then
                echo "[VGL] ERROR: vglclient failed to execute."
                exit 1
        fi
        echo
fi

if [ $VGLTUNNEL = 1 ]; then
        echo Making preliminary SSH connection to find a free port on the 
server ...
        REMOTEPORT=`$SSHCMD ${1+"$@"} "$VGL_BINDIR/nettest -findport && 
$VGL_BINDIR/vgllogin -check"`
        if [ $? -ne 0 -o "$REMOTEPORT" = "" ]; then
                echo "[VGL] ERROR: The server does not appear to have VirtualGL 
2.1 or later"
                echo "[VGL]    installed."
                exit 1
        fi
        echo Making final SSH connection ...
        if [ "$COMMAND" != "" ]; then
                $SSHCMD -t -Y -R$REMOTEPORT:localhost:$PORT ${1+"$@"} <<EOF
$VGL_BINDIR/vgllogin -s $REMOTEPORT
$COMMAND
EOF
        else
                $SSHCMD -t -Y -R$REMOTEPORT:localhost:$PORT ${1+"$@"} 
"$VGL_BINDIR/vgllogin -s "$REMOTEPORT
        fi
        exit 0
fi

if [ $X11TUNNEL = 1 ]; then
        $SSHCMD -Y ${1+"$@"}
        exit 0
fi

XAUTH=xauth
if [ -x /usr/X11R6/bin/xauth ]; then
        XAUTH=/usr/X11R6/bin/xauth
else
        if [ -x /usr/openwin/bin/xauth ]; then
                XAUTH=/usr/openwin/bin/xauth
        fi
fi
XAUTHFILE=`maketemp vglconnect`
$XAUTH -f $XAUTHFILE generate $DISPLAY . trusted timeout 0
if [ $? -ne 0 ]; then
        echo "[VGL] ERROR: Could not generate xauth key, possibly because the X 
server does"
        echo "[VGL]    not have the SECURITY extension or because the xauth 
command could "
        echo "[VGL]    not be found."
        rm -f $XAUTHFILE
        exit 1
fi
XAUTHCOOKIE=`$XAUTH -f $XAUTHFILE list | sed "s/.*[ ]//g"`
rm -f $XAUTHFILE
if [ "$CONNECT" = "1" ]; then
        $SSHCMD -t -x ${1+"$@"} "exec $VGL_BINDIR/vgllogin -x "$DISPLAY" 
"$XAUTHCOOKIE
else
        DNUM=`echo $DISPLAY | sed 's/.*[:]//g'`
        xauth add `hostname`":"$DNUM . $XAUTHCOOKIE
fi
------------------------------------------------------------------------------
_______________________________________________
VirtualGL-Users mailing list
VirtualGL-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtualgl-users

Reply via email to