Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am using Ubuntu 12.04. I want to automatically start a service after login with LightDM. This service is not meant to start on boot, but after X is initialized.

share|improve this question

2 Answers 2

If you want it to run after you login (which is how I read the title of your question), search for Startup Application in Unity and add your service there. If you are using the older desktop of Ubuntu Classic you should have something like that in the menu System Tools → Preferences → Startup Applications

share|improve this answer
You are right... It will depend on what he/she exactly wants to do. The question formulation needs to be enhanced. ( I like the way we meet in lots of question Anthon :)) ) –  Bichoy Apr 17 '13 at 4:22
Bichoy's solution does run in the user's session (so after login), not when the X server is initialized. But it doesn't run after a graphical login. –  Gilles Apr 17 '13 at 23:27

You can simply append it to the end of /etc/X11/xinit/xinitrc and it will start after X11 starts (through LightDM).

share|improve this answer
xinitrc is only read if you log in in text mode then run startx or xinit. It isn't read when you log in with a display manager such as lightdm. –  Gilles Apr 17 '13 at 23:26
Thanks for the valuable note Gilles. I revised the files hierarchy and you are absolutely right. I should have said instead xinitrc-common. I believe this one should be source by the display manager. Correct me if I don't get it right. –  Bichoy Apr 18 '13 at 1:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.