1

As part of post-start of my app say "mydaemon", I want to launch a GUI app say "mygui". I am unable to do this.

I have verified user perm using xhost, DISPLAY variable is set correctly. conf file in /etc/init/ is given below

$ cat /etc/init/agentd.conf

description  "my daemon"
author       "me"

start on runlevel [2345]
stop on runlevel [016]

console output
kill timeout 60
respawn
respawn limit 3 15

# Allow some clean up time
post-stop script
   env DISPLAY=:0.0
   cd /home/me
   ./mygui
  sleep 1
end script

script
    cd /home/me
    ./myapp
end script

post-start script
   env DISPLAY=:0.0
   cd /home/me
   ./mygui
end script

Any suggestions?

xserver is up and running before this script is run. I explicitly started the service myapp after verifying lightdm. I also made the suggested changes to the script however the gui doesn't seen to come up. Any suggestions?

1 Answer 1

0

Instead of putting the "env DISPLAY=:0.0" within the script section, put it outside. Then change the script sections to

post-start exec /home/me/mygui
post-stop exec /home/me/mygui

You may also want to change from script {...} to

exec /home/me/myapp

The other problem I can see is that the x server has not started when you try to start your GUI. I am not too sure how to fix that.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .