[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to cause a process started in .xsessionrc to terminate with x-session termination?



On Wed, Nov 17, 2021 at 10:39:21PM +0100, Arkadiusz Dabrowski wrote:
> I have a problem with unison sync termination when it is started from
> .xsessionrc.
> It works flawlessly but when I log out it is orphaned and not terminated.
> I start it like this:
> nice -n18 ionice -c2 -n7 unison unison_profile &>/dev/null &

It sounds like you don't have a .xsession (or .xinitrc) file, and are
simply using the default Debian Xsession.

It also sounds like unison is not an X application.  Usually the programs
that you start from .xsessionrc are X client apps, which will terminate
when the X server goes away at logout.  Since unison is presumably not an
X client app, it survives this.

You could try using an .xsession file.  This gives you more control over
the session.  You could even read the default Debian Xsession from your
.xsession file, to keep things simple.  For example, something like this
may meet your needs (untested):

. /etc/X11/Xsession
pkill unison

It's not the most elegant solution, but you could start with this,
see whether it works at all, and then improve it from here if it does.

There may be other solutions.  For instance, maybe you can find something
in systemd or dbus that starts a managed service as a child of your login
session, and kills it upon logout.  I don't actually know whether systemd
or dbus can do this, but if it can, it might be a better solution.


Reply to: