mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-21 22:13:19 -07:00
speed up status notifications by dropping the 'basename' shell call
and hardcode each name
This commit is contained in:
parent
f60240b969
commit
d4367660ff
13 changed files with 40 additions and 17 deletions
2
bin/arch
2
bin/arch
|
@ -18,7 +18,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Default is "on"
|
||||
p=`basename $0`
|
||||
p="cpu-count"
|
||||
grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0
|
||||
|
||||
count=`grep -c "^processor.*:" /proc/cpuinfo`
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# cpu-count: count cpu's on a systems
|
||||
# arch: print the machine architecture
|
||||
# Copyright (C) 2008 Canonical Ltd.
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@canonical.com>
|
||||
|
@ -17,9 +17,8 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Default is "on"
|
||||
p=`basename $0`
|
||||
grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0
|
||||
# Default is "off"
|
||||
p="arch"
|
||||
grep -qs "^$p=1$" "$HOME/.screen-profiles/status" || exit 0
|
||||
|
||||
count=`grep -c "^processor.*:" /proc/cpuinfo`
|
||||
[ "$count" = "1" ] || echo $count"x"
|
||||
uname -m
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Default is "on"
|
||||
p=`basename $0`
|
||||
p="cpu-freq"
|
||||
grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0
|
||||
|
||||
mhz=`grep -m 1 "^cpu MHz" /proc/cpuinfo | awk -F"[:.]" '{print $2}'`
|
||||
|
|
|
@ -22,7 +22,7 @@ FORCE=0
|
|||
DETAIL=0
|
||||
|
||||
# Default is "off"
|
||||
p=`basename $0`
|
||||
p="ec2-cost"
|
||||
grep -qs "^$p=1$" "$HOME/.screen-profiles/status" && FORCE=1
|
||||
grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && FORCE=0
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Default is "off"
|
||||
p=`basename $0`
|
||||
p="hostname"
|
||||
grep -qs "^$p=1$" "$HOME/.screen-profiles/status" || exit 0
|
||||
|
||||
echo "@"`hostname -s`
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Default is "on"
|
||||
p=`basename $0`
|
||||
p="load-average"
|
||||
grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0
|
||||
|
||||
cat /proc/loadavg | cut -d " " -f -1
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Default is on
|
||||
p=`basename $0`
|
||||
p="mem-available"
|
||||
grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0
|
||||
|
||||
mem=`free | grep -m 1 "^Mem:" | awk '{print $2}'`
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Default is on
|
||||
p=`basename $0`
|
||||
p="mem-used"
|
||||
grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0
|
||||
|
||||
free | awk '/buffers\/cache:/ {printf ",%.0f%%\n", 100*$3/($3 + $4)}'
|
||||
|
|
24
bin/menu
Executable file
24
bin/menu
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# menu: display the menu text
|
||||
# Copyright (C) 2008 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/>.
|
||||
|
||||
# Default is "on"
|
||||
p="menu"
|
||||
grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0
|
||||
|
||||
echo `gettext "Menu:<F9>"`
|
|
@ -18,7 +18,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Default is on
|
||||
p=`basename $0`
|
||||
p="reboot-required"
|
||||
grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0
|
||||
|
||||
[ -e /var/run/reboot-required ] && echo "(@)"
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Default is on
|
||||
p=`basename $0`
|
||||
p="release"
|
||||
grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0
|
||||
|
||||
echo $(/usr/bin/lsb_release -s -i) $(/usr/bin/lsb_release -s -r)
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Default is on
|
||||
p=`basename $0`
|
||||
p="updates-available"
|
||||
grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0
|
||||
|
||||
# expire the cache in X seconds; 1 hour by default
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Default is "off"
|
||||
p=`basename $0`
|
||||
p="whoami"
|
||||
grep -qs "^$p=1$" "$HOME/.screen-profiles/status" || exit 0
|
||||
|
||||
whoami
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue