[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 Mon 22 Nov 2021 at 10:58:28 (-0500), Greg Wooledge wrote:
> On Mon, Nov 22, 2021 at 03:25:02PM +0000, Musbur wrote:
> > Am 20.11.2021 22:19 schrieb Greg Wooledge:
> > > On Sat, Nov 20, 2021 at 09:46:24PM +0100, Arkadiusz Dabrowski wrote:
> > > > Started with "exec" according to Debian documentation:
> > > > https://wiki.debian.org/Xsession
> > > 
> > > You're cargo-culting stuff with zero understanding.  That's not going
> > > to help.
> > > 
> > > If you don't know how shell scripts work, if you don't know what the
> > > "exec" command does... then this is going to be quite difficult for you.
> > 
> > I know the difference between using exec and not using exec, but I've never
> > understood why Debian explicitly suggests using exec to start the wm in
> > .xsession. Maybe to release resources held by the shell instance?
> 
> Basically, yeah.  There's no reason to keep the shell around waiting
> on the window manager, if the shell isn't going to do anything after
> the WM terminates.  So, for 95% of cases, that's what you want.
> 
> The OP in this thread is an exception.  They want the shell to hang
> around so it can kill a process after the WM terminates.  A .xsession
> file without "exec" on the WM seems to be the most obvious way to do it.
> 
> (Unless someone can figure out how to make systemd do this.)

I haven't looked for differences that might have arisen since systemd
entered upon the scene (and I've yet to work my way through your
addition to this subthread), but in looking through /etc/X11/ to see
what x-session-manager might be, I see that Xsession.d has a twin,
Xreset.d, called from Xreset. This says it's for "when a user log[s]
out from a display manager", which might be what the OP is doing
"when I log out [and] it [unison] is orphaned and not terminated".

I have no idea whether it would benefit to start unison from an
Xsession.d/ file and stop it in Xreset.d/, nor how the two might
communicate information. An Xreset.d/ that's populated with examples
might suggest some ideas. However, I would have thought that the sequence
  start something in Xsession.d/
  run x-session-manager from 99x11-common_start
  stop something in Xreset.d/
was closer to the spirit of Debian's /etc/X11/ than
  start something in .xsession
  run x-session-manager from .xsession
  stop something in .xsession
but maybe I'm wrong. DMs and DEs just aren't my thing.
Anyway, you're less likely to accidentally create a loop. Sorry.

Cheers,
David.


Reply to: