2011-12-06 09:49:58 |
Daniel Hahler |
description |
I have noticed that byobu tends to report too many users for me.
Currently it says "9#", and when looking for the processes like byobu does I see:
% pgrep -fl 'sshd:.*@'
1335 sshd: user@pts/0
1731 sshd: user@pts/0
8522 sshd: user@pts/2
8600 sshd: user@pts/2
8804 sshd: user@pts/4
12344 sshd: user@pts/0
17048 sshd: user@pts/0
25590 sshd: user@pts/6
30121 sshd: user@pts/0
I think that this status notification / plugin should only count the number of distinct users.
What do you think about using something more in line of the following?
pgrep -fl 'sshd:.*@' | cut -f3 -d\ | cut -f1 -d@ | sort -u | wc -l
Besides, looking at the output of "w", I only see the following:
% w
[snip]
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
user pts/1 192.168.x.x:S Thu18 22.00s 0.49s 0.49s /usr/bin/zsh
user pts/3 192.168.x.x:S 09:56 6:53 1.01s 0.57s vim .dotfiles/oh-my-zsh/plugins/byobu/lib
user pts/2 192.168.x.x:S 09:53 11:03 0.34s 0.34s /usr/bin/zsh
user pts/4 192.168.x.x:S 10:00 0.00s 0.31s 0.00s w
This appears to reflect the 4 windows in the byobu/screen session.
I do not know where the other sshd processes are coming from.. |
I have noticed that byobu tends to report too many users for me.
Currently it says "9#", and when looking for the processes like byobu does I see:
% pgrep -fl 'sshd:.*@'
1335 sshd: user@pts/0
1731 sshd: user@pts/0
8522 sshd: user@pts/2
8600 sshd: user@pts/2
8804 sshd: user@pts/4
12344 sshd: user@pts/0
17048 sshd: user@pts/0
25590 sshd: user@pts/6
30121 sshd: user@pts/0
I think that this status notification / plugin should only count the number of distinct users.
What do you think about using something more in line of the following?
pgrep -fl 'sshd:.*@' | cut -f3 -d\ | cut -f1 -d@ | sort -u | wc -l
Or even better use "who" to get a list of all logins, including local ones:
who | cut -f1 -d\ | sort -u | wc -l
If you really want to count only remote/sshd logins, you could filter by the 5th column of "who", or use some of its options maybe.
Besides, looking at the output of "w", I only see the following:
% w
[snip]
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
user pts/1 192.168.x.x:S Thu18 22.00s 0.49s 0.49s /usr/bin/zsh
user pts/3 192.168.x.x:S 09:56 6:53 1.01s 0.57s vim .dotfiles/oh-my-zsh/plugins/byobu/lib
user pts/2 192.168.x.x:S 09:53 11:03 0.34s 0.34s /usr/bin/zsh
user pts/4 192.168.x.x:S 10:00 0.00s 0.31s 0.00s w
This appears to reflect the 4 windows in the byobu/screen session.
I do not know where the other sshd processes are coming from.. |
|