From 7912e8e0d98e3285b0d96eda34588a9397ac98b2 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Sat, 6 Nov 2010 21:52:52 -0500 Subject: [PATCH] * etc/byobu/statusrc, usr/bin/byobu-config, usr/lib/byobu/mail, usr/lib/byobu/Makefile.am, usr/lib/byobu/raid, usr/share/byobu/profiles/common, usr/share/man/man1/byobu.1: - add a raid notification, LP: #669191 --- debian/changelog | 4 +++ etc/byobu/statusrc | 1 + usr/bin/byobu-config | 1 + usr/lib/byobu/Makefile.am | 2 +- usr/lib/byobu/mail | 2 +- usr/lib/byobu/raid | 43 +++++++++++++++++++++++++++++++++ usr/share/byobu/profiles/common | 3 ++- usr/share/man/man1/byobu.1 | 2 ++ 8 files changed, 55 insertions(+), 3 deletions(-) create mode 100755 usr/lib/byobu/raid diff --git a/debian/changelog b/debian/changelog index 755e7129..160ba891 100644 --- a/debian/changelog +++ b/debian/changelog @@ -44,6 +44,10 @@ byobu (3.7) unreleased; urgency=low usr/share/byobu/profiles/byoburc, usr/share/byobu/profiles/common, usr/share/man/man1/byobu.1: - xdg user dirs overhaul, LP: #553105 + * etc/byobu/statusrc, usr/bin/byobu-config, usr/lib/byobu/mail, + usr/lib/byobu/Makefile.am, usr/lib/byobu/raid, + usr/share/byobu/profiles/common, usr/share/man/man1/byobu.1: + - add a raid notification, LP: #669191 -- Dustin Kirkland Thu, 21 Oct 2010 12:09:14 -0500 diff --git a/etc/byobu/statusrc b/etc/byobu/statusrc index ecd5bbfb..9ecfea5f 100644 --- a/etc/byobu/statusrc +++ b/etc/byobu/statusrc @@ -43,6 +43,7 @@ menu=1 network=0 notify_osd=0 processes=0 +raid=1 rcs_cost=0 reboot_required=1 release=1 diff --git a/usr/bin/byobu-config b/usr/bin/byobu-config index 41b8aab7..b0eb1f9a 100755 --- a/usr/bin/byobu-config +++ b/usr/bin/byobu-config @@ -314,6 +314,7 @@ def readstatus(): status["network"]=0 status["notify_osd"]=0 status["processes"]=0 + status["raid"]=1 status["rcs_cost"]=0 status["reboot_required"]=1 status["release"]=1 diff --git a/usr/lib/byobu/Makefile.am b/usr/lib/byobu/Makefile.am index cc8528d9..8e48e72f 100644 --- a/usr/lib/byobu/Makefile.am +++ b/usr/lib/byobu/Makefile.am @@ -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 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 time time_utc updates_available uptime users whoami wifi_quality diff --git a/usr/lib/byobu/mail b/usr/lib/byobu/mail index 0b470f75..69495ec6 100755 --- a/usr/lib/byobu/mail +++ b/usr/lib/byobu/mail @@ -26,4 +26,4 @@ if [ "$1" = "--detail" ]; then exit 0 fi -[ -s "$mailfile" ] && printf "$(color w k)[M]$(color -) " || exit 0 +[ -s "$mailfile" ] && printf "$(color w k)[M]$(color -)" || exit 0 diff --git a/usr/lib/byobu/raid b/usr/lib/byobu/raid new file mode 100755 index 00000000..e8882e3e --- /dev/null +++ b/usr/lib/byobu/raid @@ -0,0 +1,43 @@ +#!/bin/sh -e +# +# raid: notify raid events, failures and syncing +# Copyright (C) 2010 Canonical Ltd. +# +# Authors: Dustin Kirkland +# +# 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 . + +PKG="byobu" +color 2>/dev/null || color() { true; } + +case $1 in + --detail) + cat /proc/mdstat + exit 0 + ;; +esac + +if grep -qs " blocks \[.*_.*\]$" /proc/mdstat; then + # Errors in your raid + msg="RAID" +fi + +if grep -qs \% /proc/mdstat; then + p=$(grep \% /proc/mdstat | sed -e "s/\%.*//" -e "s/.* //") + sync=",$p%%" +fi + +if [ -n "$msg" ]; then + printf "$(color B w r)%s%s$(color -)" "$msg" "$sync" +fi + diff --git a/usr/share/byobu/profiles/common b/usr/share/byobu/profiles/common index d56be0e2..f8d3bae6 100644 --- a/usr/share/byobu/profiles/common +++ b/usr/share/byobu/profiles/common @@ -73,6 +73,7 @@ backtick 131 53 53 byobu-status services 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 hardstatus alwayslastline @@ -106,7 +107,7 @@ source $HOME/.local/share/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`%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`%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'. diff --git a/usr/share/man/man1/byobu.1 b/usr/share/man/man1/byobu.1 index 02ef9198..fb329d43 100644 --- a/usr/share/man/man1/byobu.1 +++ b/usr/share/man/man1/byobu.1 @@ -41,6 +41,8 @@ Note that DATA=\fI$HOME/.local/share/byobu\fP, per XDG Base Directory Specificat \fBec2_cost\fP \- an estimation of the cost of the current boot of the system in terms of the Amazon EC2 billing model; displayed in the lower bar toward the right in green text on a black background; there is a leading '~' to indicate that this is an estimation, and the monetary units are US Dollars '$' +\fBraid\fP \- note very prominently if there is a RAID failure detected, in red blinking text on a white background; the term 'RAID' notes that there is something wrong with the RAID, and if there is a rebuild/resync in progress, the percent complete is also shown + \fBrcs_cost\fP \- an estimation of the cost of the current boot of the system in terms of the Rackspace Cloud Server billing model; displayed in the lower bar toward the right in green text on a black background; there is a leading '~' to indicate that this is an estimation, and the monetary units are US Dollars '$' \fBfan_speed\fP \- cpu or system fan speed as reported by lm-sensors; displayed in the lower bar toward the right in black text on a grey background; there is a trailing 'rpm' for units