starting X applications at boot

From: Lucio Chiappetti (lucio@mi.iasf.cnr.it)
Date: Mon Jun 17 2002 - 11:45:21 EDT


A colleague of mine has the need to start at boot an application requiring
access to the X display (well, not quite, requires existence of the X
display although it does not use it, see below for details). The thing is
on Solaris 2.7 with CDE.

So I placed an S99 script in /etc/rc3.d which sets the environment
variable DISPLAY to machinename:0.0 and starts the application. With no
avail (the application runs, but later either hangs or gives a display
access error).

I thought this was due to the fact that the X server is not yet started
when the rc3 scripts are executed (CDE starts it later). Therefore I
placed in the S99 script an "at" command which defers the application
start by a few minutes. Still with no avail.

Incidentally, the application is a SDK java servlet server, which
"requires" the existence of an X server (for AWT graphics) although it
DOES NOT DRAW on the physical display at all ! The java classes we use
actually produce GIF, JPEG or PS graphics and return it via http !

I know that the standard solutions recommended for headless servers are
the use of a virtual frame buffer (Xvfb, which is told to be very
difficult to compile) or of a "pure java" version of AWT (PJA).

However we are not using an headless server, an X server is already
running on the machine, so why can't we exploit it ?

What I noticed is that if I start the java server manually, it never
complains. If however I start it with DISPLAY set to a remote host to
which I have no access, if fails later with a X11 permission error on the
first attempt to create graphics. If I start it with DISPLAY set to a
remote host to which I have access (xhost +) at java start time, I can
later produce all graphics even if I've revoked the access. Conversely if
I use a local DISPLAY, it works in manual mode, while if I do it at boot,
the java graphics hangs without error (and, as soon as I stop java, gives
a "document contains no data" error).

What is curious is that if I at boot set DISPLAY to a remote host, all
works fine provided the remote host has the Solaris machine running java
in its X access list. At present I use as remote host an Alpha, and keep
the Sun in its X access list adding its name to /etc/X0.hosts.

How can I grant the same kind of access to the Solaris X server from any
application local on the same server ?

If I log on the Sun, an xhost just says
access control enabled, only authorized clients can connect
without any list of host, even the local host is excluded.

If I log on the Alpha, xhost instead says "access control enabled, only
authorized clients can connect" but also lists the local host name
(because this is in /etc/X0.hosts and because I've disabled MIT magic
cookies on the Alpha).

Can I do the same on the Sun, and how ? (Or can I grant X11 access to the
java server otherwise ?)

Please reply by e-mail (I am not a regular subscriber of this list), and I
will post a summary

----------------------------------------------------------------------------
Lucio Chiappetti - IASF/CNR - via Bassini 15 - I-20133 Milano (Italy)
For more info : http://www.mi.iasf.cnr.it/~lucio/personal.html
----------------------------------------------------------------------------
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:24:30 EDT