mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-22 14:24:39 -07:00
bin/*: route and ifconfig are in /sbin, fully qualify
-Dustin Kirkland <kirkland@ubuntu.com>Thu, 16 Apr 2009 12:37:21 -0500
This commit is contained in:
parent
6a04028343
commit
b01eb70a12
5 changed files with 8 additions and 7 deletions
|
@ -63,7 +63,7 @@ RX_RATE="0.10"
|
||||||
TX_RATE="0.17"
|
TX_RATE="0.17"
|
||||||
|
|
||||||
# Auto detect network interface
|
# Auto detect network interface
|
||||||
IF=`route -n | grep "0\.0\.0\.0" | tail -n1 | awk '{print $8}'`
|
IF=`/sbin/route -n | grep "0\.0\.0\.0" | tail -n1 | awk '{print $8}'`
|
||||||
|
|
||||||
# Calculate bandwidth cost
|
# Calculate bandwidth cost
|
||||||
tx_gb=`/sbin/ifconfig "$IF" | grep "TX bytes:" | sed "s/^.*TX bytes://" | awk '{ printf "%f", $1 / 1024 / 1024 / 1024 }'`
|
tx_gb=`/sbin/ifconfig "$IF" | grep "TX bytes:" | sed "s/^.*TX bytes://" | awk '{ printf "%f", $1 / 1024 / 1024 / 1024 }'`
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
cache="$HOME/.screen-profiles/network-down"
|
cache="$HOME/.screen-profiles/network-down"
|
||||||
interface=`route -n | tail -n 1 | sed "s/^.* //"`
|
interface=`/sbin/route -n | tail -n 1 | sed "s/^.* //"`
|
||||||
unit="kB/s"
|
unit="kB/s"
|
||||||
|
|
||||||
t1=`stat -c %Y "$cache"` 2>/dev/null || t1=0
|
t1=`stat -c %Y "$cache"` 2>/dev/null || t1=0
|
||||||
|
@ -28,7 +28,7 @@ if [ $t2 -le $t1 ]; then
|
||||||
rate=0
|
rate=0
|
||||||
else
|
else
|
||||||
x1=`cat "$cache"` 2>/dev/null || tx1=0
|
x1=`cat "$cache"` 2>/dev/null || tx1=0
|
||||||
x2=`ifconfig "$interface" | grep "RX bytes" | sed "s/^.*RX bytes://" | sed "s/ .*$//"`
|
x2=`/sbin/ifconfig "$interface" | grep "RX bytes" | sed "s/^.*RX bytes://" | sed "s/ .*$//"`
|
||||||
echo "$x2" > "$cache"
|
echo "$x2" > "$cache"
|
||||||
rate=`echo "$t1" "$t2" "$x1" "$x2" | awk '{printf "%.0f", ($4 - $3) / ($2 - $1) / 1024 }'`
|
rate=`echo "$t1" "$t2" "$x1" "$x2" | awk '{printf "%.0f", ($4 - $3) / ($2 - $1) / 1024 }'`
|
||||||
if [ "$rate" -gt 1024 ]; then
|
if [ "$rate" -gt 1024 ]; then
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
cache="$HOME/.screen-profiles/network-up"
|
cache="$HOME/.screen-profiles/network-up"
|
||||||
|
|
||||||
interface=`route -n | tail -n 1 | sed "s/^.* //"`
|
interface=`/sbin/route -n | tail -n 1 | sed "s/^.* //"`
|
||||||
unit="kB/s"
|
unit="kB/s"
|
||||||
|
|
||||||
t1=`stat -c %Y "$cache"` 2>/dev/null || t1=0
|
t1=`stat -c %Y "$cache"` 2>/dev/null || t1=0
|
||||||
|
@ -29,7 +29,7 @@ if [ $t2 -le $t1 ]; then
|
||||||
rate=0
|
rate=0
|
||||||
else
|
else
|
||||||
x1=`cat "$cache"` 2>/dev/null || tx1=0
|
x1=`cat "$cache"` 2>/dev/null || tx1=0
|
||||||
x2=`ifconfig "$interface" | grep "TX bytes" | sed "s/^.*TX bytes://" | sed "s/ .*$//"`
|
x2=`/sbin/ifconfig "$interface" | grep "TX bytes" | sed "s/^.*TX bytes://" | sed "s/ .*$//"`
|
||||||
echo "$x2" > "$cache"
|
echo "$x2" > "$cache"
|
||||||
rate=`echo "$t1" "$t2" "$x1" "$x2" | awk '{printf "%.0f", ($4 - $3) / ($2 - $1) / 1024 }'`
|
rate=`echo "$t1" "$t2" "$x1" "$x2" | awk '{printf "%.0f", ($4 - $3) / ($2 - $1) / 1024 }'`
|
||||||
if [ "$rate" -gt 1024 ]; then
|
if [ "$rate" -gt 1024 ]; then
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
# 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/>.
|
||||||
|
|
||||||
interface=`route -n | tail -n 1 | sed "s/^.* //"`
|
interface=`/sbin/route -n | tail -n 1 | sed "s/^.* //"`
|
||||||
bitrate=`iwconfig "$interface" 2>/dev/null | grep "Bit Rate." | sed "s/^.*Bit Rate.//" | sed "s/ .*$//g"`
|
bitrate=`iwconfig "$interface" 2>/dev/null | grep "Bit Rate." | sed "s/^.*Bit Rate.//" | sed "s/ .*$//g"`
|
||||||
[ -z "$bitrate" ] && bitrate="0"
|
[ -z "$bitrate" ] && bitrate="0"
|
||||||
quality=`iwconfig "$interface" 2>/dev/null | grep "Link Quality=" | sed "s/^.*Link Quality=//" | sed "s/ .*$//g"`
|
quality=`iwconfig "$interface" 2>/dev/null | grep "Link Quality=" | sed "s/^.*Link Quality=//" | sed "s/ .*$//g"`
|
||||||
|
|
3
debian/changelog
vendored
3
debian/changelog
vendored
|
@ -5,11 +5,12 @@ screen-profiles (1.45) unreleased; urgency=low
|
||||||
* bin/uptime: don't print seconds, since we don't update often enough
|
* bin/uptime: don't print seconds, since we don't update often enough
|
||||||
* screen-profiles-status: use home bin scripts, if available first,
|
* screen-profiles-status: use home bin scripts, if available first,
|
||||||
then fallback to system-wide, allows for local overrides
|
then fallback to system-wide, allows for local overrides
|
||||||
|
* bin/*: route and ifconfig are in /sbin, fully qualify
|
||||||
|
|
||||||
[ Jon Bernard <bernardj@gmail.com> ]
|
[ Jon Bernard <bernardj@gmail.com> ]
|
||||||
* debian/control: fix typo in screen-profiles-extras description
|
* debian/control: fix typo in screen-profiles-extras description
|
||||||
|
|
||||||
-- Dustin Kirkland <kirkland@ubuntu.com> Thu, 16 Apr 2009 12:27:13 -0500
|
-- Dustin Kirkland <kirkland@ubuntu.com> Thu, 16 Apr 2009 12:37:21 -0500
|
||||||
|
|
||||||
screen-profiles (1.44-0ubuntu1) jaunty; urgency=low
|
screen-profiles (1.44-0ubuntu1) jaunty; urgency=low
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue