I work on a distributed system with a central control station. On this central control station we have software which will connect to any number of remote computers running Fedora 16 and a specialized SystemD daemon. Once connected, the control station sends messages to these daemons in order to launch various GUI systems used for user interaction with the central control station.
Currently there is a huge downside to this, in that these remote computers require a particular user to be logged in before the GUI's can be brought up. This user is the same user as is running the SystemD daemon. If these remote computers are not logged in we receive the following java error:
Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.
The daemon is written in Java (using the latest java 7) and uses the following code in order launch the GUIs:
String command = "java -Xmx2000M -cp ...{java classes etc to run}"
ProcessBuilder pb = new ProcessBuilder(command.split("\\s+"));
pb.redirectErrorStream(true);
pb.environment().put("DISPLAY", ":0.0");
try
{
p = pb.start();
...
This is the correct DISPLAY variable when a user is properly logged on. The daemon itself does not know that there is a Display because of when it starts, so we currently set the DISPLAY variable in the ProcessBuilder
Is there some way to properly connect/logon to the X11 Window Server either through java or some other means through my daemons so that these systems do not need to be manually logged in to prior to running.
Currently, all these systems auto-loggin on start up to KDE as the appropriate user, but that isn't a very secure solution, and people have a tendency to log them out at random, stopping them from functioning as remote stations
Edit /etc/inittab so X starts with OS. Instructions
Create file .Xinitrc in your home directory. From it start your daemon, and if you need window manager start it too.