Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss] runlevel 5 service cannot connect to display



William Chan wrote:
> ...my service needs x11
> My service subscribes to Messaging Queue and makes call to an
> application which uses x11.
> 
> I also tried to run startX in the start script to start :1 and export DISPLAY=:1.

I ran into similar problem when creating a daemon that receives critical
priority syslog messages broadcast on my LAN and displays them on the X
display.

It's natural to think of these sorts of daemons as if they are like any
other daemon, but like Rich points out, this isn't really a system service.

Instead, you need to invert your model a bit. This service doesn't
accomplish anything if X isn't running, right? And probably not if no
one is logged in to X, right? It doesn't need to run as root, ether - in
fact it is desired that it run as the logged in X user.

So really what you have is a GUI client that receives messages from some
other process. That GUI client should be ran by the user logged in to X.
GNOME and other desktops provide mechanisms to automate this (Startup
Applications). I believe the old-school solution is to launch your GUI
from .xinitrc or .xsession:
http://www.acm.uiuc.edu/workshops/cool_unix/xinitrc.html

which will be ran as the target user and is executed after the X
environment is up and running.

If you want the behavior to be global, presumably you'll need to modify
the system default scripts, like /etc/X11/Xsession.

 -Tom

-- 
Tom Metro
Venture Logic, Newton, MA, USA
"Enterprise solutions through open source."
Professional Profile: http://tmetro.venturelogic.com/



BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org