service application that has access to the GUI
I have written the app that has a GUI part (it generates images from invisible javafx controls and saves them into images). As a next step I'd like to make it an application that is always running, i.e. something like a service.
I have looked at monit to make it a service, but monit complains:
Failed in XOpenDisplay
(java:4465): Gtk-WARNING **: cannot open display:
Do you have an idea if I can use monit or any similar application to directly run my app?
Features I need:
start my app after reboot
restart my app if it goes down
Any help is appreciated.
Have you tried having the GUI user enabling local access to their X display?
You have directed me to the right direction (knew what to search for on the internet), thank you for your help.
For beginners like I am:
If you want to run a process from a shell that is not a child process of X, define an environment variable:
Maybe you'll need to run the above recommended
and then start your app, and it will find the primary X server (of course X server has to be running for this).
So now to run my app as a service, I run monit from an ordinary user account with the -c switch (how to do it during pc start is the next thing I'll need to look at)
(I need the -c switch so that it uses a config file that I supply rather than the config file in /etc which is set up so that it needs to be run as root because it reads/writes everything in /var)
To run monit as a daemon I do monit -c <conffile> -d 60
And in the startMyApp script I simply added
So I can run monit from a shell that is not a child process of X and my app will be able to use the GUI.
|All times are GMT -5. The time now is 07:39 AM.|