speed up status notifications by dropping the 'basename' shell call

and hardcode each name
This commit is contained in:
Dustin Kirkland 2009-03-12 18:01:22 -05:00
commit d4367660ff
13 changed files with 40 additions and 17 deletions

View file

@ -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`

View file

@ -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

View file

@ -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}'`

View file

@ -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

View file

@ -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`

View file

@ -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

View file

@ -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}'`

View file

@ -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
View 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>"`

View file

@ -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 "(@)"

View file

@ -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)

View file

@ -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

View file

@ -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