[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 Tue 23 Nov 2021 at 07:51:32 (-0500), Greg Wooledge wrote:
> On Tue, Nov 23, 2021 at 12:05:37PM +0000, Jonathan Dowland wrote:
> > On Mon, Nov 22, 2021 at 11:39:46AM -0500, Greg Wooledge wrote:
> > > I don't know the exact time that I closed the login shell on tty2.  It
> > > *could* have been at exactly 11:19:00 but that seems like a suspiciously
> > > round number (and a suspiciously long time after I started the service).
> > 
> > You don't, but your system(d) does: the system instance, not the user
> > instance.
> > 
> > From my "journalctl --follow" output, after a "su -" and then
> > immediately after closing the resulting shell:
> > 
> > 	Nov 23 12:03:27 coil su[1330250]: pam_unix(su-l:session): session closed for user root
> 
> Nov 22 11:18:27 unicorn systemd[1604310]: Started Sleep command for testing.
> Nov 22 11:18:50 unicorn login[1604301]: pam_unix(login:session): session closed>
> Nov 22 11:18:50 unicorn systemd[1]: getty@tty2.service: Succeeded.
> Nov 22 11:18:50 unicorn systemd[1]: session-7634.scope: Succeeded.
> Nov 22 11:18:50 unicorn systemd[1]: getty@tty2.service: Scheduled restart job, >
> Nov 22 11:18:50 unicorn systemd-logind[611]: Session 7634 logged out. Waiting f>
> Nov 22 11:18:50 unicorn systemd[1]: Stopped Getty on tty2.
> Nov 22 11:18:50 unicorn systemd[1]: Started Getty on tty2.
> Nov 22 11:18:50 unicorn systemd-logind[611]: Removed session 7634.
> Nov 22 11:18:50 unicorn pulseaudio[1604331]: Error opening PCM device front:1: >
> Nov 22 11:18:50 unicorn systemd[1604310]: pulseaudio.service: Succeeded.
> Nov 22 11:19:00 unicorn systemd[1]: Stopping User Manager for UID 1004...
> 
> This basically confirms my guesswork: the "User Manager" isn't stopped
> immediately when the last login session is closed.  There's some delay.
> Maybe it's the next time the clock reads *:00 or maybe it's 10 seconds.

It looks like you can set it here:

$ grep 1min /etc/systemd/system.conf 
#DefaultTimerAccuracySec=1min
$ man systemd-system.conf | grep -A7 DefaultTimerAccuracySec 
       DefaultTimerAccuracySec=
           Sets the default accuracy of timer units. This controls the global default
           for the AccuracySec= setting of timer units, see systemd.timer(5) for
           details.  AccuracySec= set in individual units override the global default
           for the specific unit. Defaults to 1min. Note that the accuracy of timer
           units is also affected by the configured timer slack for PID 1, see
           TimerSlackNSec= above.

$ 

> Nov 22 11:19:00 unicorn systemd[1]: Stopping User Manager for UID 1004...
> Nov 22 11:19:00 unicorn systemd[1604310]: Stopped target Main User Target.
> Nov 22 11:19:00 unicorn systemd[1604310]: Stopping D-Bus User Message Bus...
> Nov 22 11:19:00 unicorn systemd[1604310]: Stopping Multimedia Service...
> Nov 22 11:19:00 unicorn systemd[1604310]: Stopping Sleep command for testing...
> Nov 22 11:19:00 unicorn systemd[1604310]: dbus.service: Succeeded.
> Nov 22 11:19:00 unicorn systemd[1604310]: Stopped D-Bus User Message Bus.
> Nov 22 11:19:00 unicorn systemd[1604310]: sleeper.service: Succeeded.
> Nov 22 11:19:00 unicorn systemd[1604310]: Stopped Sleep command for testing.
> [...]
> 
> It seems to do what's desired.  That's the important takeaway.

Cheers,
David.


Reply to: