Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! 2.6/7 » The Bar » Wine and X (Running Stars! on a server without an active X server)
Wine and X Thu, 19 September 2013 08:14 Go to next message
XAPBob is currently offline XAPBob

 
Lt. Commander

Messages: 957
Registered: August 2012
So you have a linux box which is used to host Stars! files, and maybe even to run Stars using a remote connection scheme such as NX, but you want to run some reports and scripts from a plain SSH terminal, without X forwarding pointless data. (if you even have an X client on your device)

The problem is that Stars! assumes that you have a display. Even if you run a CLI only command (-dpfm for instance) Stars! requires a display - it pushes windows which afaict never get populated before they are closed. Without an X server you get:
Quote:
Make sure that your X server is running and that $DISPLAY is set correctly.

Sad

The solution is Xvfb - the X virtual frame buffer
This provides an X session that doesn't actually display anywhere (although you can export the display, or forward it via VNC if you want).

So prefix your scripts with the following:
export DISPLAY=:100
Xvfb :100 -screen 0 1024x768x16 2>/dev/null &


This will make Stars! behave properly Very Happy

Of course if you sometimes run these from a session with DISPLAY already set then you may want to save that variable at the start of the script and reinstate it as soon as possible.
And also you will want to kill the frame buffer after you have finished with it, so, fortunately "jobs" works just happily in a script - so we can pass the list of background tasks to "kill":

OLDDISPLAY=$DISPLAY
Xvfb :100 -screen 0 1024x768x16 2>/dev/null &
export DISPLAY=:100
./stars.exe -dpfm game.m4
export DISPLAY=$OLDDISPLAY
kill $(jobs -p)
# Process data here



I'm putting together some tools etc into a VM - it will be at least next year before it gets released (need to finish lowtek, as well as having lots of things to do over Christmas.

Report message to a moderator

Re: Wine and X Thu, 19 September 2013 09:39 Go to previous messageGo to next message
skoormit is currently offline skoormit

 
Lieutenant

Messages: 665
Registered: July 2008
Location: Alabama
This is...beautiful.


What we need's a few good taters.

Report message to a moderator

Re: Wine and X Thu, 19 September 2013 14:47 Go to previous messageGo to next message
XAPBob is currently offline XAPBob

 
Lt. Commander

Messages: 957
Registered: August 2012
skoormit wrote on Thu, 19 September 2013 14:39
This is...beautiful.

Thank you Smile

I've only reported it, with a couple of hints. The real credit goes to Linus and co., the developers of Wine, Xvfb and of course the Jeffs Very Happy

It is pretty neat though. All I need now is to have fetchmail do its magic and have others email me their turns Smile
For instance, SAH could email all of the turns for a game and this would be able to generate all sorts of information / maps automatically...


[Updated on: Thu, 19 September 2013 14:49]

Report message to a moderator

Re: Wine and X Thu, 19 September 2013 18:08 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
XAPBob wrote on Thu, 19 September 2013 14:14
This will make Stars! behave properly Very Happy

What happens if/when Stars! prompts for user input (pwds, etc)? Hit Computer



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: Wine and X Thu, 19 September 2013 18:30 Go to previous messageGo to next message
XAPBob is currently offline XAPBob

 
Lt. Commander

Messages: 957
Registered: August 2012
You should have supplied them in your script. Basically it will block, waiting for input, allowing you to grab a "screenshot" to diagnose where you stuffed up Wink
xwd -display :100 -root -out image.xwd
convert image.xwd image.png


There is also an existing wrapper script "xvfb-run command" which I've only just spotted...


[Updated on: Thu, 19 September 2013 18:39]

Report message to a moderator

Re: Wine and X Fri, 14 March 2014 16:49 Go to previous messageGo to next message
XAPBob is currently offline XAPBob

 
Lt. Commander

Messages: 957
Registered: August 2012
Getting files emailed has been resolved using dropbox - since I use this to share data and keep archives accessible it's a good fit for me.

there is an application called "sendtodropbox" which makes a nice email address, and anything sent there ends up in a specific directory on dropbox.

I am using this for hosting games - that email address gets put on all the players settings, and the file gets sent to my dropbox as well as the player. Then a script files the data away (using Wumpus' magic file) and then uses StarsPlayerTool (Xyligun) to export interesting data (message pane export for instance).


[Updated on: Fri, 14 March 2014 16:50]

Report message to a moderator

Re: Wine and X Fri, 14 March 2014 21:51 Go to previous message
magic9mushroom is currently offline magic9mushroom

 
Commander

Messages: 1361
Registered: May 2008
When I first saw this thread's title I thought it was talking about playing Stars! while drunk.

Guess that shows how much I know about Linux... Rolling Eyes

Report message to a moderator

Previous Topic: Possible Game: Clown Car
Next Topic: Race file won't open in one directory, will open in another directory
Goto Forum:
  


Current Time: Mon May 06 09:49:50 EDT 2024