Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
When I run a program, is there a way I can specify a parent PID for that program? I want all of my X programs (yammi, thunderbird, various dockapps, etc) to be parented to .xsession.
My first question is why? And no, well at least not that I know of. It all depends on how the program is designed to run, etc. But I'm still wondering why you'd want a parent PID for all your X related programs, etc.
Why? Because when I end my X session, I sometimes have a bunch of programs floating around still running that chew up memory and sometimes interfere with new instances.
If a program is written badly and goes AWOL on
exit you won't benefit from all having the same PPID
because in that situation they probably won't respond
to a kill either ...
For a process to be a child of a parent process, that parent has to spawn that process. I don't know of any way you can start a process and force it to attach itself to a parent.
I guess you could try to put everything you want to start in a ~/.xsession file to start when X does. But just starting a process once X is already started which seems to be what you want to do is not going to work.
Besides, this won't work anyhow since children are definitely not killed when their parents exit.* Instead they are "adopted" by init, which will clean them up when they exit.
* Unless, in some situations, when you get an entire process group orphaned. See section 9.10 of W. Richard Stevens Advanced Programming the Unix Environment for all the gory details.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.