On Mon, 20 Jun 2011 15:15 +0800, "XeCycle" <xecycle@xxxxxxxxx> wrote: > Hello. I need to start several programs after login and > after startx. Now I write these directly in my .bash_profile > and .xinitrc; but I'm not satisfied with this. They cannot > be easily stopped after logout. To do that I think I'd > record their PID and kill them in .bash_logout, also need to > take care when they're manually stopped, and all these > related problems. > > So I think a set of scripts like the daemon managing from > initscripts will be nice. But I can't write /etc/rc.d > daemons, as they must be executed by a normal user. > > Has anyone written such a tool? > > Thank you. > Instead of doing exec startx, you can background startx and wait for it, allowing your script to complete and clean things up. I don't know of a specific tool for managing user processes though, however you could "copy" rc.d/? files and amend them for your own usage. ~/.xinitrc: #! /bin/bash start stuff startx & wait $? stop stuff