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

Re: best way to check for an active X session from a maintainer script?

On Tue, Sep 11, 2007 at 03:34:27AM -0600, Bruce Sass wrote:
> On Tue September 11 2007 01:07:52 am Steve Langasek wrote:
> > Does anyone know of a case where this would give the wrong result? 
> > I'm not sure what an xdmcp login would look like here, for instance,
> > or if startx creates a utmp entry that I should be concerned about
> > registering as a false positive.

> Running "who" from a `startx startkde' (issued on tty1) session,
> also logged in via XDMCP from smokie,
> and via KDM...

> bsass@onegee:~$ who
> bsass    tty1         Sep 11 03:05
> bsass    smokie:0     Sep 11 03:14 (smokie)
> bsass    :0           Sep 11 03:16

Ok, so there's no utmp entry for the startx, but there is one for XDMCP that
includes the hostname?  Thanks, I guess that means we should go with this
instead, not anchoring the match to the beginning of the terminal field:

   who | awk '{print $2}'|grep -q ':[0-9]'

Look reasonable?

I think that leaves only one corner case where we will fail to restart
[kwx]dm when it's safe to do so, and that's where *two* DMs are running on
the system, one is gdm, and only gdm has an active login associated with it.

Unless anybody has any clever ideas how to close that corner case, I'm
willing to go with this solution.

Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
vorlon@debian.org                                   http://www.debian.org/

Reply to: