~ubuntu-branches/ubuntu/utopic/byobu/utopic

« back to all changes in this revision

Viewing changes to usr/lib/byobu/users

  • Committer: Bazaar Package Importer
  • Author(s): Dustin Kirkland
  • Date: 2010-01-11 22:54:36 UTC
  • mto: This revision was merged to the branch mainline in revision 49.
  • Revision ID: james.westby@ubuntu.com-20100111225436-csnrc41k0bewth1e
Tags: upstream-2.47
Import upstream version 2.47

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh -e
 
2
#
 
3
#  users: print the number of remote users on the machine
 
4
#  Copyright (C) 2009 Raphaël Pinson.
 
5
#  Copyright (C) 2009 Canonical Ltd.
 
6
#
 
7
#  Authors: Raphaël Pinson <raphink@ubuntu.com>
 
8
#           Dustin Kirkland <kirkland@canonical.com>
 
9
#
 
10
#  This program is free software: you can redistribute it and/or modify
 
11
#  it under the terms of the GNU General Public License as published by
 
12
#  the Free Software Foundation, version 3 of the License.
 
13
#
 
14
#  This program is distributed in the hope that it will be useful,
 
15
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
#  GNU General Public License for more details.
 
18
#
 
19
#  You should have received a copy of the GNU General Public License
 
20
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
21
#
 
22
 
 
23
PKG="byobu"
 
24
color 2>/dev/null || color() { true; }
 
25
 
 
26
if [ "$1" = "--detail" ]; then
 
27
        ps -ef | grep "sshd;.*@" | grep -v grep
 
28
        exit 0
 
29
fi
 
30
 
 
31
# Note: we'd like to use pgrep -c, however, this isn't available in
 
32
# busybox and some distro's pgrep (and it doesn't exit non-zero).
 
33
count=`pgrep -f "sshd:.*@" | wc -l` || exit 0
 
34
[ $count -gt 0 ] && printf "$(color b w r)%d$(color -)$(color w r)#$(color -) " $count