mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-20 05:23:20 -07:00
* experimental/byobu-aggregate-status, usr/bin/byobu-status,
usr/lib/byobu/logo, usr/lib/byobu/Makefile.am, usr/lib/byobu/mem_available => usr/lib/byobu/memory, usr/lib/byobu/mem_used, usr/lib/byobu/.shutil, usr/share/byobu/status/status, usr/share/man/man1/byobu.1: - drop experimental code, no longer necessary - test non-zero cache file - combine mem_* to memory - decrease raid status frequency - add trailing space to logo
This commit is contained in:
parent
2911e3c0f6
commit
598a3aa3f0
10 changed files with 43 additions and 144 deletions
10
debian/changelog
vendored
10
debian/changelog
vendored
|
@ -37,6 +37,16 @@ byobu (4.30) unreleased; urgency=low
|
||||||
* usr/bin/byobu-config:
|
* usr/bin/byobu-config:
|
||||||
- migrate to toggling on/off the list of status items
|
- migrate to toggling on/off the list of status items
|
||||||
- fix initial seeding of status config
|
- fix initial seeding of status config
|
||||||
|
* experimental/byobu-aggregate-status, usr/bin/byobu-status,
|
||||||
|
usr/lib/byobu/logo, usr/lib/byobu/Makefile.am,
|
||||||
|
usr/lib/byobu/mem_available => usr/lib/byobu/memory,
|
||||||
|
usr/lib/byobu/mem_used, usr/lib/byobu/.shutil,
|
||||||
|
usr/share/byobu/status/status, usr/share/man/man1/byobu.1:
|
||||||
|
- drop experimental code, no longer necessary
|
||||||
|
- test non-zero cache file
|
||||||
|
- combine mem_* to memory
|
||||||
|
- decrease raid status frequency
|
||||||
|
- add trailing space to logo
|
||||||
|
|
||||||
-- Dustin Kirkland <kirkland@ubuntu.com> Thu, 11 Aug 2011 10:31:31 -0500
|
-- Dustin Kirkland <kirkland@ubuntu.com> Thu, 11 Aug 2011 10:31:31 -0500
|
||||||
|
|
||||||
|
|
|
@ -1,72 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
PKG="byobu"
|
|
||||||
|
|
||||||
hput() {
|
|
||||||
eval "$1""$2"='$3'
|
|
||||||
}
|
|
||||||
|
|
||||||
hget() {
|
|
||||||
eval echo '${'"$1$2"'#hash}'
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
hput freq apport 67
|
|
||||||
hput freq arch 9999999
|
|
||||||
hput freq battery 61
|
|
||||||
hput freq color 9999999
|
|
||||||
hput freq cpu_count 5
|
|
||||||
hput freq cpu_freq 2
|
|
||||||
hput freq cpu_temp 19
|
|
||||||
hput freq custom 5
|
|
||||||
hput freq date 28793
|
|
||||||
hput freq disk 13
|
|
||||||
hput freq disk_io 3
|
|
||||||
hput freq ec2_cost 601
|
|
||||||
hput freq fan_speed 23
|
|
||||||
hput freq hostname 607
|
|
||||||
hput freq ip_address 127
|
|
||||||
hput freq load_average 2
|
|
||||||
hput freq logo 9999999
|
|
||||||
hput freq mail 5
|
|
||||||
hput freq mem_available 47
|
|
||||||
hput freq mem_used 13
|
|
||||||
hput freq menu 9999999
|
|
||||||
hput freq network 3
|
|
||||||
hput freq notify_osd 0
|
|
||||||
hput freq processes 7
|
|
||||||
hput freq raid 7
|
|
||||||
hput freq rcs_cost 613
|
|
||||||
hput freq reboot_required 5
|
|
||||||
hput freq release 599
|
|
||||||
hput freq services 53
|
|
||||||
hput freq swap 19
|
|
||||||
hput freq time 9999999
|
|
||||||
hput freq time_binary 23
|
|
||||||
hput freq time_utc 11
|
|
||||||
hput freq trash 9999999
|
|
||||||
hput freq updates_available 7
|
|
||||||
hput freq uptime 29
|
|
||||||
hput freq users 11
|
|
||||||
hput freq whoami 86029
|
|
||||||
hput freq wifi_quality 17
|
|
||||||
|
|
||||||
# Update
|
|
||||||
NOW=$(date +%s)
|
|
||||||
for i in /usr/lib/$PKG/*; do
|
|
||||||
j=${i##*/}
|
|
||||||
#byobu-status "$j" > "$BYOBU_RUN_DIR/$j.status"
|
|
||||||
CACHE="$BYOBU_RUN_DIR/$j.status"
|
|
||||||
[ -r "$CACHE.last" ] && read lastrun < "$CACHE.last" || lastrun=0
|
|
||||||
freq=$(hget freq $j)
|
|
||||||
expiration=$(($lastrun+$freq))
|
|
||||||
if [ $NOW -ge $expiration ]; then
|
|
||||||
byobu-status "$j" > "$CACHE" 2>/dev/null
|
|
||||||
echo "${NOW}" > "$CACHE.last"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Print
|
|
||||||
sed -e ':a;N;$!ba;s/\n//g' "$BYOBU_RUN_DIR/"*.status > "$BYOBU_RUN_DIR/status"
|
|
||||||
|
|
||||||
# vi: syntax=sh ts=4 noexpandtab
|
|
|
@ -49,7 +49,9 @@ get_status() {
|
||||||
"__$1" > "$cachepath"
|
"__$1" > "$cachepath"
|
||||||
echo "$NOW" > "$lastpath"
|
echo "$NOW" > "$lastpath"
|
||||||
fi
|
fi
|
||||||
IFS= read line < "$cachepath"; printf "$line"
|
if [ -s "$cachepath" ]; then
|
||||||
|
IFS= read line < "$cachepath"; printf "$line"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
|
|
@ -232,13 +232,12 @@ status_freq() {
|
||||||
load_average) _RET=2 ;;
|
load_average) _RET=2 ;;
|
||||||
logo) _RET=9999999 ;;
|
logo) _RET=9999999 ;;
|
||||||
mail) _RET=5 ;;
|
mail) _RET=5 ;;
|
||||||
mem_available) _RET=47 ;;
|
memory) _RET=13 ;;
|
||||||
mem_used) _RET=13 ;;
|
|
||||||
menu) _RET=9999999 ;;
|
menu) _RET=9999999 ;;
|
||||||
network) _RET=3 ;;
|
network) _RET=3 ;;
|
||||||
notify_osd) _RET=9999999 ;;
|
notify_osd) _RET=9999999 ;;
|
||||||
processes) _RET=7 ;;
|
processes) _RET=7 ;;
|
||||||
raid) _RET=7 ;;
|
raid) _RET=59 ;;
|
||||||
rcs_cost) _RET=613 ;;
|
rcs_cost) _RET=613 ;;
|
||||||
reboot_required) _RET=5 ;;
|
reboot_required) _RET=5 ;;
|
||||||
release) _RET=599 ;;
|
release) _RET=599 ;;
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
libdirdir = $(prefix)/lib/@PACKAGE@
|
libdirdir = $(prefix)/lib/@PACKAGE@
|
||||||
libdir_SCRIPTS = apport arch battery cpu_count cpu_freq cpu_temp color 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_binary time_utc trash updates_available uptime users whoami wifi_quality .common .constants .dirs .shutil
|
libdir_SCRIPTS = apport arch battery cpu_count cpu_freq cpu_temp color custom date disk disk_io ec2_cost fan_speed hostname ip_address load_average logo mail memory menu network .notify_osd notify_osd processes raid rcs_cost reboot_required release services swap time time_binary time_utc trash updates_available uptime users whoami wifi_quality .common .constants .dirs .shutil
|
||||||
|
|
||||||
|
|
|
@ -116,6 +116,7 @@ __logo() {
|
||||||
$MARKUP && printf "$(color b k W)%s$(color -)" "$logo" || printf " $logo "
|
$MARKUP && printf "$(color b k W)%s$(color -)" "$logo" || printf " $logo "
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
printf " "
|
||||||
}
|
}
|
||||||
|
|
||||||
# vi: syntax=sh ts=4 noexpandtab
|
# vi: syntax=sh ts=4 noexpandtab
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
#!/bin/sh -e
|
|
||||||
#
|
|
||||||
# mem_available: grab the current memory and usage
|
|
||||||
#
|
|
||||||
# Copyright (C) 2008 Canonical Ltd.
|
|
||||||
# Copyright (C) 2011 Dustin Kirkland
|
|
||||||
#
|
|
||||||
# Authors: Dustin Kirkland <kirkland@ubuntu.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/>.
|
|
||||||
|
|
||||||
__mem_available_detail() {
|
|
||||||
free
|
|
||||||
}
|
|
||||||
|
|
||||||
__mem_available() {
|
|
||||||
local mem_used comma whitespace unit mem name
|
|
||||||
[ "$mem_used" = "1" ] && comma="," || whitespace=" "
|
|
||||||
read name mem unit < /proc/meminfo
|
|
||||||
if [ $mem -ge 1048576 ]; then
|
|
||||||
fpdiv "$mem" 1048567 1
|
|
||||||
mem=${_RET}
|
|
||||||
unit="GB"
|
|
||||||
elif [ $mem -ge 1024 ]; then
|
|
||||||
fpdiv "$mem" 1024 0
|
|
||||||
mem=${_RET}
|
|
||||||
unit="MB"
|
|
||||||
else
|
|
||||||
mem="$mem"
|
|
||||||
unit="KB"
|
|
||||||
fi
|
|
||||||
color b g W; printf "%s" "$mem"; color -; color g W; printf "%s%s" "$unit" "$comma"; color -; printf "%s" "$whitespace"
|
|
||||||
}
|
|
||||||
|
|
||||||
# vi: syntax=sh ts=4 noexpandtab
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
#
|
#
|
||||||
# mem_used: grab the current memory usage
|
# mem_available: grab the current memory and usage
|
||||||
#
|
#
|
||||||
# Copyright (C) 2008 Canonical Ltd.
|
# Copyright (C) 2008 Canonical Ltd.
|
||||||
# Copyright (C) 2011 Dustin Kirkland
|
# Copyright (C) 2011 Dustin Kirkland
|
||||||
|
@ -19,16 +19,11 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
__mem_used_detail() {
|
__memory() {
|
||||||
cat /proc/meminfo
|
free
|
||||||
}
|
}
|
||||||
|
|
||||||
__mem_used() {
|
__memory() {
|
||||||
# originally, this script did:
|
|
||||||
# f=$(free | awk '/buffers\/cache:/ {printf "%.0f", 100*$3/($3 + $4)}')
|
|
||||||
# this method is more dependent on /proc/meminfo, but uses the same formula
|
|
||||||
# for deriving the output of 'free' that is used in procps 'free.c'
|
|
||||||
# kb_main_free, kb_main_total, kb_main_buffers, kb_main_cached
|
|
||||||
local free="" total="" buffers="" cached=""
|
local free="" total="" buffers="" cached=""
|
||||||
local kb_main_used=0 buffers_plus_cached=0 fo_buffers=0 fo_cached=0
|
local kb_main_used=0 buffers_plus_cached=0 fo_buffers=0 fo_cached=0
|
||||||
while read tok val unit; do
|
while read tok val unit; do
|
||||||
|
@ -40,14 +35,25 @@ __mem_used() {
|
||||||
esac
|
esac
|
||||||
[ -n "${free}" -a -n "${total}" -a -n "${buffers}" -a -n "${cached}" ] && break;
|
[ -n "${free}" -a -n "${total}" -a -n "${buffers}" -a -n "${cached}" ] && break;
|
||||||
done < /proc/meminfo
|
done < /proc/meminfo
|
||||||
kb_main_used=$(($total-$free))
|
kb_main_used=$(($total-$free))
|
||||||
buffers_plus_cached=$(($buffers+$cached))
|
buffers_plus_cached=$(($buffers+$cached))
|
||||||
# "free output" buffers and cache (output from 'free')
|
# "free output" buffers and cache (output from 'free')
|
||||||
fo_buffers=$(($kb_main_used - $buffers_plus_cached))
|
fo_buffers=$(($kb_main_used - $buffers_plus_cached))
|
||||||
fo_cached=$(($kb_main_free + $buffers_plus_cached))
|
fo_cached=$(($kb_main_free + $buffers_plus_cached))
|
||||||
fpdiv $((100*${fo_buffers})) "${total}" 0;
|
fpdiv $((100*${fo_buffers})) "${total}" 0;
|
||||||
f=${_RET}
|
f=${_RET}
|
||||||
color b g W; printf "%s" "$f"; color -; color g W; printf "%s" "$PCT"; color --
|
if [ $total -ge 1048576 ]; then
|
||||||
|
fpdiv "$total" 1048567 1
|
||||||
|
total=${_RET}
|
||||||
|
unit="GB"
|
||||||
|
elif [ $total -ge 1024 ]; then
|
||||||
|
fpdiv "$total" 1024 0
|
||||||
|
total=${_RET}
|
||||||
|
unit="MB"
|
||||||
|
else
|
||||||
|
unit="KB"
|
||||||
|
fi
|
||||||
|
color b g W; printf "%s" "$total"; color -; color g W; printf "%s," "$unit"; color -; color b g W; printf "%s" "$f"; color -; color g W; printf "%s" "$PCT"; color --
|
||||||
}
|
}
|
||||||
|
|
||||||
# vi: syntax=sh ts=4 noexpandtab
|
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -24,8 +24,8 @@
|
||||||
screen_upper_left="color"
|
screen_upper_left="color"
|
||||||
screen_upper_right="color whoami hostname ip_address menu"
|
screen_upper_right="color whoami hostname ip_address menu"
|
||||||
screen_lower_left="color logo release #arch"
|
screen_lower_left="color logo release #arch"
|
||||||
screen_lower_right="color network #disk_io custom raid reboot_required updates_available #apport #services #mail users uptime #ec2_cost #rcs_cost #fan_speed #cpu_temp battery wifi_quality #processes load_average cpu_count cpu_freq mem_available mem_used #swap #disk #time_utc date time"
|
screen_lower_right="color network #disk_io custom raid reboot_required updates_available #apport #services #mail users uptime #ec2_cost #rcs_cost #fan_speed #cpu_temp battery wifi_quality #processes load_average cpu_count cpu_freq memory #swap #disk #time_utc date time"
|
||||||
|
|
||||||
# Tmux has one status line, with 2 halves for status
|
# Tmux has one status line, with 2 halves for status
|
||||||
tmux_left="logo release #arch"
|
tmux_left="logo release #arch"
|
||||||
tmux_right="network #disk_io custom raid reboot_required updates_available #apport #services #mail users uptime #ec2_cost #rcs_cost #fan_speed #cpu_temp battery wifi_quality #processes load_average cpu_count cpu_freq mem_available mem_used #swap #disk #whoami #hostname #ip_address #time_utc date time"
|
tmux_right="network #disk_io custom raid reboot_required updates_available #apport #services #mail users uptime #ec2_cost #rcs_cost #fan_speed #cpu_temp battery wifi_quality #processes load_average cpu_count cpu_freq memory #swap #disk #whoami #hostname #ip_address #time_utc date time"
|
||||||
|
|
|
@ -57,9 +57,7 @@ Note that BYOBU_CONFIG_DIR=\fI$HOME/.byobu\fP.
|
||||||
|
|
||||||
\fBmail\fP \- system mail for the current user; the letter '[M]' is displayed in the lower bar toward the left in black text on a grey background
|
\fBmail\fP \- system mail for the current user; the letter '[M]' is displayed in the lower bar toward the left in black text on a grey background
|
||||||
|
|
||||||
\fBmem_available\fP \- total memory available in the system; displayed in the lower bar toward the right in white text on a green background
|
\fBmemory\fP \- total memory available and used in the system; displayed in the lower bar toward the right in white text on a green background
|
||||||
|
|
||||||
\fBmem_used\fP \- total memory used in the system as a percentage of the total memory available; displayed in the lower bar toward the right in white text on a green background with a trailing '%' sign
|
|
||||||
|
|
||||||
\fBmenu\fP \- a simple indicator directing new users to use the F9 keybinding to access the byobu menu
|
\fBmenu\fP \- a simple indicator directing new users to use the F9 keybinding to access the byobu menu
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue