On Fr, Dez 09, 2011 at 18:58:35 (CET), Moritz Struebe wrote:
> --- a/x2goserver/bin/x2gostartagent
> +++ b/x2goserver/bin/x2gostartagent
> @@ -120,8 +120,8 @@ USED_DISPLAYS=`$X2GO_LIB_PATH/x2gogetdisplays $HOSTNAME`
> while [ "$OUTPUT" != "inserted" ]; do
> X2GO_PORT=$(($X2GO_PORT + 1))
> X2GO_PORT=`echo "for(\\$i=$X2GO_PORT;\\$br ne \"true\";\\$i++){
> if(\"$USED_DISPLAYS\" =~
> m/\\|\\$i\\|/){\\$br=\"false\";}else{\\$br=\"true\";print \\$i;}}"|perl`
> -
> - if [ -e "/tmp/.X${X2GO_PORT}-lock" ] || [ -e
> "/tmp/.X11-unix/X${X2GO_PORT}" ]; then
> + #Test if the session is already in use. nxagent uses 6000+DISPLAY to
> open a port. Therefore this must be tested, too.
> + if [ -e "/tmp/.X${X2GO_PORT}-lock" ] || [ -e
> "/tmp/.X11-unix/X${X2GO_PORT}" ] || `netstat -ntl | grep ":${X2GO_PORT} "` ;
> then
> OUTPUT="XXX"
> else
> SESSION_NAME=${USER}-${X2GO_PORT}-`date +"%s"`
That looks overly convoluted to me. What about this (untested, but shell
syntax works):
if [ -e "/tmp/.X${X2GO_PORT}-lock" ] ||
[ -e "/tmp/.X11-unix/X${X2GO_PORT}" ] ||
netstat -ntl 2>/dev/null | grep -q ":${X2GO_PORT}"; then
OUTPUT="XXX"
else
SESSION_NAME=${USER}-${X2GO_PORT}-`date +"%s"`
fi
Cheers,
Reinhard
--
Gruesse/greetings,
Reinhard Tartler, KeyID 945348A4
_______________________________________________
X2go-Dev mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/x2go-dev