Start X2GO sessions when server boots?

Asked by adam jvok

I have an X2go server running nicely.
Users can run the x2go client to create sessions, use for a while, disconnect and resume the same sessions later.
All is good.

What I would like to do, and can not figure out, is how to have the server create an X2go when the server boots.
The idea is that the server:
boots.
Starts a number of X2go sessions (one per user)
Each session starts up various applications for users.
Later, users 'resume' these sessions, having all their apps ready to use.

So, is there some command line way (on the server) of creating x2go client sessions and then leaving them in a disconnected state so they can be resumed by real users later?

Thanks for any help.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
adam jvok
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

You can use /etc/rc.local to start commands as root. You can use su to run them as other usernames.

What are the users connecting to achieve? There may be a sleeker solution.

Revision history for this message
adam jvok (ajvok1) said :
#2

Thanks for the reply.

Yes, I start things from rc.local, but the question is: what?

I need a command that will create the x2go client sessions on the server when the server boots, so that they are ready for the users to 'resume' when users wan to connect and use these sessions.

> What are the users connecting to achieve? There may be a sleeker solution.
The x2go sessions run a gui app (its java based) that needs to be operating pretty much 24x7, but only occasionally needs user interaction.
The app needs to start when the server boots, and stay running even when the user(s) is/are not connected.
If I had full control of the source code then I could easily resolve this in a sleeker way, but I'm stuck with the gui app the way it is.

Thanks

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3

What command do you run to start the application normally?

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#4

If the app is java based, can it not be embedded in a browser?

Revision history for this message
adam jvok (ajvok1) said :
#5

The application is rather complex and interacts with several other systems, so does not lend itself to being launched from a browser either as an applet or via webstart. There is currently no option of running it other than on the server.

I have discovered a way of starting x2go client session from the command line:
1. Download the perl script "x2goclient-cli" from http://code.x2go.org/gitweb?p=x2goclient.git;a=blob_plain;f=examples/x2goclient-cli
2. Create a new session by:
perl x2goclient-cli --user username --server host --command /usr/bin/icewm --add-to-known-hosts yes
3. Kill this program & the session remains, in a suspended state, ready for user to connect to later.

This is heading in the right direction, but still has one problem: x2goclient-cli pops up a gui windows of the new sessions desktop on the current terminal - I want this session creation process to be done entirely without any gui windows appearing.

In an attempt to solve that, I used xvfb. - like this:

xvfb-run perl x2goclient-cli --user username --server host --command /usr/bin/icewm --add-to-known-hosts yes

The session is created, with no gui appearing on the current terminal. Great.

... BUT.. when I later try to 'resume' the session using the x2goclient, I get "Failed to open the display. Can't resume NX session on this display". and x2goclient writes this to stdout (or err):
 search proxy win: "X2GO-[user]-50-1366977708"

I feel close. Any ideas?

Revision history for this message
Manfred Hampl (m-hampl) said :
#6

I guess you will get better support when posting that on the x2go forum http://x2go-community.org/forum

Revision history for this message
adam jvok (ajvok1) said :
#7

I did as you suggested and posted to the x2go forum, no reply yet.
Maybe they can come up with some better method, but after messing with this for a while I do have a working solution:

1. Get a copy of the perl script "x2goclient-cli" from:
http://code.x2go.org/gitweb?p=x2goclient.git;a=blob_plain;f=examples/x2goclient-cli

2. On my system, in order to run this I need to also install a couple of dependencies:
sudo apt-get install libproc-simple-perl libterm-readpassword-perl

3. When I use x2goclient-cli to create a session, to avoid it being displayed (we want no gui during the automated session creation stage), we will use a dummy xserver, so:
sudo apt-get install xserver-xorg-video-dummy

4. Create an xorg.conf for the dummy server. I used the one from:
http://xpra.org/xorg.conf
but modified the line
Virtual 8192 4096
to
Virtual 800 600

5. Put the new xorg.conf in some dir and cd there, then start the dummy xserver with:
Xorg -noreset -logfile ./10.log -config ./xorg.conf :10

6. Create an x2go client session with:
export DISPLAY=:10
perl x2goclient-cli --user USERNAME --server SERVER --command /usr/bin/icewm --add-to-known-hosts yes

7. From remote (user) machine, run the x2goclient, find and suspend the existing session as created above, then resume it.

Maybe mad, but does work.