You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
708 B

  1. --- a/usr/lib/byobu/users
  2. +++ b/usr/lib/byobu/users
  3. @@ -26,7 +26,12 @@ __users_detail() {
  4. }
  5. __users() {
  6. - local count=0
  7. + local count=0 f pid
  8. + for f in /var/run/dropbear.*.pid; do
  9. + read pid < "$f"
  10. + count=$(($count + $(pgrep -P "$pid" | wc -l)))
  11. + done
  12. + if [ $count -eq 0 ]; then
  13. if [ "$USERS_DISTINCT" = "1" ]; then
  14. count=$(pgrep -fl 'sshd:.*@' | cut -f3 -d\ | cut -f1 -d@ | sort -u | wc -l)
  15. else
  16. @@ -34,6 +39,7 @@ __users() {
  17. # busybox and some distro's pgrep (and it doesn't exit non-zero).
  18. count=$(pgrep -f "^sshd:.*@|^/usr/sbin/sshd -i" | wc -l) || return
  19. fi
  20. + fi
  21. if [ $count -gt 0 ]; then
  22. color b w r; printf "%d" "$count"; color -; color w r; printf "##"; color --
  23. else