diff --git a/debian/changelog b/debian/changelog index 5424c1bb..55b6a2e0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -28,6 +28,10 @@ byobu (4.53) unreleased; urgency=low - use ~/.local/share/byobu as BYOBU_CONFIG_DIR, if it happens to exist * usr/lib/byobu/include/dirs: LP: #899271 - allow explicit BYOBU_CONFIG_DIR selection in ~/.byoburc + * usr/lib/byobu/users, usr/share/byobu/status/statusrc, + usr/share/man/man1/byobu.1: LP: #900663 + - add support for a USERS_DISTINCT=1 status configuration setting + to count the number of distinct users, rather than open ssh sessions [ Andrew McCarthy ] * usr/bin/byobu-status: LP: #898801 diff --git a/usr/lib/byobu/users b/usr/lib/byobu/users index cba95828..79952412 100755 --- a/usr/lib/byobu/users +++ b/usr/lib/byobu/users @@ -27,9 +27,13 @@ __users_detail() { __users() { local count - # Note: we'd like to use pgrep -c, however, this isn't available in - # busybox and some distro's pgrep (and it doesn't exit non-zero). - count=`pgrep -f "sshd:.*@" | wc -l` || return + if [ "$USERS_DISTINCT" = "1" ]; then + count=$(pgrep -fl 'sshd:.*@' | cut -f3 -d\ | cut -f1 -d@ | sort -u | wc -l) + else + # Note: we'd like to use pgrep -c, however, this isn't available in + # busybox and some distro's pgrep (and it doesn't exit non-zero). + count=$(pgrep -f "sshd:.*@" | wc -l) || return + fi if [ $count -gt 0 ]; then color b w r; printf "%d" "$count"; color -; color w r; printf "#"; color -- fi diff --git a/usr/share/byobu/status/statusrc b/usr/share/byobu/status/statusrc index 34edd513..aaef12e2 100644 --- a/usr/share/byobu/status/statusrc +++ b/usr/share/byobu/status/statusrc @@ -58,3 +58,12 @@ #SERVICES="eucalyptus-nc|NC eucalyptus-cloud|CLC eucalyptus-walrus eucalyptus-cc|CC eucalyptus-sc|SC" #FAN=$(find /sys -type f -name fan1_input | head -n1) + +# You can set this to 1 to report your external/public ip address +# Default: 0 +#IP_EXTERNAL=0 + +# The users notification normally counts ssh sessions; set this configuration to '1' +# to instead count number of distinct users logged onto the system +# Default: 0 +#USERS_DISTINCT=0 diff --git a/usr/share/man/man1/byobu.1 b/usr/share/man/man1/byobu.1 index 060d09d9..11dfbedd 100644 --- a/usr/share/man/man1/byobu.1 +++ b/usr/share/man/man1/byobu.1 @@ -91,7 +91,7 @@ Note that BYOBU_CONFIG_DIR=\fI$XDG_CONFIG_HOME/byobu\fP if defined, and \fI$HOME \fBuptime\fP \- the total system uptime since last boot; displayed in the lower bar toward the right in blue text on a grey background -\fBusers\fP \- the number of remote users logged into the system via sshd, empty if 0 users; displayed in the lower bar toward the right in red text on a grey background with a trailing '#' sign +\fBusers\fP \- the number of remote users logged into the system via sshd, empty if 0 users; displayed in the lower bar toward the right in red text on a grey background with a trailing '#' sign; set USERS_DISTINCT=1 to instead count the number of distinct users logged into the system (rather than open ssh sessions) \fBwhoami\fP \- the name of the user who owns the screen session; displayed in the upper bar toward the far right in bold black text on a grey background