On Wed, Aug 26, 2015 at 07:16:57AM +0800, 積丹尼 Dan Jacobson wrote:
> Somehow the case where everybody is using X windows should be detected
> vs. really no users.
> 
> $ w
>  07:15:44 up 21 min,  0 users,  load average: 0.08, 0.12, 0.14
> USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
Generally users that don't have their login process is why w doesn't
show them.

If you run utmpdump /var/run/utmp this shows the current utmp database.
The second column is the process ID of the login process.
ps <PID> should then show this process.

$ utmpdump /var/run/utmp  | grep '\[:0  \]'
Utmp dump of /var/run/utmp
[7] [05857] [:0  ] [csmall  ] [:0          ] [:0                  ] [0.0.0.0    
    ] [Mon Aug 31 22:24:28 2015    ]
$ ps 5857
  PID TTY      STAT   TIME COMMAND
 5857 ?        Sl     0:00 gdm-session-worker [pam/gdm-password]
$ w | grep gdm
csmall   :0       :0               22:24   ?xdm?   2days  0.04s 
gdm-session-worker [pam/gdm-password]

-- 
Craig Small (@smallsees)   http://enc.com.au/       csmall at : enc.com.au
Debian GNU/Linux           http://www.debian.org/   csmall at : debian.org
GPG fingerprint:        5D2F B320 B825 D939 04D2  0519 3938 F96B DF50 FEA5

Reply via email to