etc/byobu/statusrc, usr/bin/byobu-config, usr/lib/byobu/Makefile.am,

usr/lib/byobu/swap, usr/share/byobu/profiles/common,
usr/share/man/man1/byobu.1: add a swap memory usage notification,
LP: #677259
This commit is contained in:
Dustin Kirkland 2010-11-18 20:43:19 -06:00
commit e20ead2cf9
7 changed files with 52 additions and 3 deletions

6
debian/changelog vendored
View file

@ -1,10 +1,14 @@
byobu (3.10) unreleased; urgency=low
byobu (3.10-0ubuntu1) natty; urgency=low
* usr/lib/byobu/custom: fix typo in for loop, LP: #673728, thanks for
the triage Jorge E. Gómez
* usr/bin/byobu-janitor: make sure this runs to completion, LP: #676605
* usr/lib/byobu/cpu_freq: scale bogomips by number of processors, if
using bogomips to estimate frequency, LP: #675442
* etc/byobu/statusrc, usr/bin/byobu-config, usr/lib/byobu/Makefile.am,
usr/lib/byobu/swap, usr/share/byobu/profiles/common,
usr/share/man/man1/byobu.1: add a swap memory usage notification,
LP: #677259
-- Dustin Kirkland <kirkland@ubuntu.com> Fri, 12 Nov 2010 22:45:25 -0600

View file

@ -48,6 +48,7 @@ rcs_cost=0
reboot_required=1
release=1
services=1
swap=0
time=1
time_utc=0
users=0

View file

@ -325,6 +325,7 @@ def readstatus():
status["reboot_required"]=1
status["release"]=1
status["services"]=1
status["swap"]=0
status["time"]=1
status["time_utc"]=0
status["users"]=0

View file

@ -1,3 +1,3 @@
libdirdir = $(prefix)/lib/@PACKAGE@
libdir_SCRIPTS = apport arch battery cpu_count cpu_freq cpu_temp custom date disk disk_io ec2_cost fan_speed hostname ip_address load_average logo mail mem_available mem_used menu network .notify_osd notify_osd processes raid rcs_cost reboot_required release services time time_utc updates_available uptime users whoami wifi_quality
libdir_SCRIPTS = apport arch battery cpu_count cpu_freq cpu_temp custom date disk disk_io ec2_cost fan_speed hostname ip_address load_average logo mail mem_available mem_used menu network .notify_osd notify_osd processes raid rcs_cost reboot_required release services swap time time_utc updates_available uptime users whoami wifi_quality

40
usr/lib/byobu/swap Executable file
View file

@ -0,0 +1,40 @@
#!/bin/sh -e
#
# mem_swap: show the current swap available and used
# Copyright (C) 2010 Canonical Ltd.
#
# Authors: Dustin Kirkland <kirkland@canonical.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
PKG="byobu"
color 2>/dev/null || color() { true; }
if [ "$1" = "--detail" ]; then
cat /proc/meminfo
exit 0
fi
f=$(free | awk '/Swap:/ {printf "%.0f", 100*$3/($3 + $4)}' 2>/dev/null || echo 0)
mem=$(free | awk '/Swap:/ {print $2}')
if [ $mem -ge 1048576 ]; then
mem=$(echo "$mem" | awk '{ printf "%.1f", $1 / 1048576 }')
unit="GB"
elif [ $mem -ge 1024 ]; then
mem=$(echo "$mem" | awk '{ printf "%.0f", $1 / 1024 }')
unit="MB"
else
mem="$mem"
unit="KB"
fi
printf "$(color b G W)s%s$(color -)$(color G W)%s,$(color -)$(color b G W)%s$(color -)$(color G W)%%$(color -) " "$mem" "$unit" "$f"

View file

@ -74,6 +74,7 @@ backtick 132 11 11 byobu-status time_utc
backtick 133 3 3 byobu-status disk_io
backtick 134 613 613 byobu-status rcs_cost
backtick 135 7 7 byobu-status raid
backtick 136 19 19 byobu-status swap
hardstatus alwayslastline
@ -107,7 +108,7 @@ source $HOME/.byobu/keybindings
caption always "%12`%?%-Lw%50L>%?%{=r}%n*%f %t%?(%u)%?%{-}%12`%?%+Lw%?%11` %=%12`%110`%109`%122`%111`%10`%<"
# Status string, last line
hardstatus string '%99`%{-}%{=r}%12` %100`%112`%= %130`%135`%102`%101`%129`%131`%127`%114`%115`%108`%134`%128`%125`%126`%113`%119`%133`%117`%116`%106`%104`%103`%105`%107`%123`%132`%120`%121`'
hardstatus string '%99`%{-}%{=r}%12` %100`%112`%= %130`%135`%102`%101`%129`%131`%127`%114`%115`%108`%134`%128`%125`%126`%113`%119`%133`%117`%116`%106`%104`%103`%105`%107`%136`%123`%132`%120`%121`'
# NOTE: Older version of screen have an arbitrary limit of only being able
# to change colors 16 times in this 'hardstatus string'.

View file

@ -75,6 +75,8 @@ Note that DATA=\fI$HOME/.byobu\fP.
\fBservices\fP \- users can configure a list of services to monitor, define the SERVICES variable in \fI$DATA/status\fP, a whitespace separated of services, each service should include the init name of the service, then a pipe, and then an abbreviated name or symbol to display when running; displayed in the lower bar toward the center in cyan on a white background
\fBswap\fP \- total swap space and total used as a percentage of the total available; displayed in the lower bar toward the right in white text on a light green background with a trailing '%' sign
\fBtime\fP \- the system time in HH:MM:SS format; displayed in the lower bar on the far right in the default text and default background colors
\fBtime_utc\fP \- the UTC system time in HH:MMformat; displayed in the lower bar on the far right in dark text on a light background