usr/lib/byobu/disk_io: improve MONITORED_DISK overriding

This commit is contained in:
Dustin Kirkland 2010-04-26 18:25:50 -05:00
commit 0536f042d2
2 changed files with 9 additions and 7 deletions

1
debian/changelog vendored
View file

@ -9,6 +9,7 @@ byobu (2.72) UNRELEASED; urgency=low
share/man/man1/byobu.1: added a disk throughput notification share/man/man1/byobu.1: added a disk throughput notification
* usr/bin/byobu-janitor: add hyphenation to the regex to allow for * usr/bin/byobu-janitor: add hyphenation to the regex to allow for
disk_io disk_io
* usr/lib/byobu/disk_io: improve MONITORED_DISK overriding
-- Dustin Kirkland <kirkland@ubuntu.com> Thu, 22 Apr 2010 12:31:20 -0500 -- Dustin Kirkland <kirkland@ubuntu.com> Thu, 22 Apr 2010 12:31:20 -0500

View file

@ -20,15 +20,16 @@
PKG="byobu" PKG="byobu"
color 2>/dev/null || color() { true; } color 2>/dev/null || color() { true; }
# Allow interface overrides in $HOME/.$PKG/status # Default to disk providing /, but let users override with MONITORED_DISK
if [ -n "$MONITORED_DISK" ]; then [ -z "$MONITORED_DISK" ] && MP="/" || MP="$MONITORED_DISK"
disk="$MONITORED_DISK" case $MP in
else /dev/*) disk="$MP" ;;
disk=$(df -h / | tail -n1 | sed -e "s/[0-9].*$//" -e "s:^.*/::") *) disk=$(grep -m 1 " $MP " /etc/mtab | sed -e "s: .*$::") ;;
fi esac
disk=$(echo "$disk" | sed -e "s: .*$::" -e "s:^.*/::" -e "s:[0-9]*$::")
if [ "$1" = "--detail" ]; then if [ "$1" = "--detail" ]; then
if [ -x /usr/bin/iostat ]; then if which iostat >/dev/null; then
iostat -d -m -h iostat -d -m -h
else else
echo "Please install iostat if you want detailed information on your disk throughput" echo "Please install iostat if you want detailed information on your disk throughput"