Centos – How to start application after login on CentOS

centosupstart

I am trying to start GUI application with upstart script on CentOS. I have test script located /etc/init/ folder.

start on desktop-session-start
stop on desktop-shutdown

respawn

script
export DISPLAY=:0
sleep 5
exec /.1/Projects/UpstartTest/start.sh &

end script

start.sh scripts is running binary files for GUI application.

After reboot my computer. When I typed:

[root@mg-CentOS ~]# initctl status test
test stop/waiting

So my upstart is not runnig. When i type

initctl start test

manually it works fine without any problem.

How can I run this upstart script after user login (desktop started) ?
I am trying to find detailed documents for CentOS for upstart but there is no.

Best Answer

On 7 use gnome-session-properties to edit this in the GUI:

example

This will add a .desktop file in ~/.config/autostart/. You can also alternatively copy the .desktop file yourself.

Related Question