usr/lib/ec2_cost, usr/lib/rcs_cost

This commit is contained in:
Dustin Kirkland 2010-06-24 12:02:32 -05:00
commit 31f0d49667
3 changed files with 9 additions and 4 deletions

1
debian/changelog vendored
View file

@ -3,6 +3,7 @@ byobu (2.81) unreleased; urgency=low
* Save some forks:
- usr/bin/byobu-status
- usr/lib/byobu/custom
- usr/lib/ec2_cost, usr/lib/rcs_cost
- usr/lib/byobu/ip_address
- usr/lib/byobu/release
- usr/lib/services

View file

@ -66,8 +66,10 @@ IF=`tail -n1 /proc/net/route | awk '{print $1}'`
ifconfig_out=`LC_ALL=C /sbin/ifconfig "$IF"`
# Calculate bandwidth cost
tx_gb=`echo "$ifconfig_out" | grep "TX bytes:" | sed "s/^.*TX bytes://" | awk '{ printf "%f", $1 / 1024 / 1024 / 1024 }'`
rx_gb=`echo "$ifconfig_out" | grep "RX bytes:" | sed "s/^.*RX bytes://" | awk '{ printf "%f", $1 / 1024 / 1024 / 1024 }'`
tx_gb=${ifconfig_out#*RX bytes:}
tx_gb=$(echo ${tx_gb%% *} | awk '{ printf "%f", $1 / 1024 / 1024 / 1024 }')
rx_gb=${ifconfig_out#*TX bytes:}
rx_gb=$(echo ${rx_gb%% *} | awk '{ printf "%f", $1 / 1024 / 1024 / 1024 }')
network_cost=`echo "$tx_gb" "$TX_RATE" "$rx_gb" "$RX_RATE" | awk '{printf "%f %f", $1*$2, $3*$4}' | awk '{printf "%f", $1 + $2}'`
# Calculate uptime cost

View file

@ -69,8 +69,10 @@ IF=`tail -n1 /proc/net/route | awk '{print $1}'`
ifconfig_out=`LC_ALL=C /sbin/ifconfig "$IF"`
# Calculate bandwidth cost
tx_gb=`echo "$ifconfig_out" | grep "TX bytes:" | sed "s/^.*TX bytes://" | awk '{ printf "%f", $1 / 1024 / 1024 / 1024 }'`
rx_gb=`echo "$ifconfig_out" | grep "RX bytes:" | sed "s/^.*RX bytes://" | awk '{ printf "%f", $1 / 1024 / 1024 / 1024 }'`
tx_gb=${ifconfig_out#*RX bytes:}
tx_gb=$(echo ${tx_gb%% *} | awk '{ printf "%f", $1 / 1024 / 1024 / 1024 }')
rx_gb=${ifconfig_out#*TX bytes:}
rx_gb=$(echo ${rx_gb%% *} | awk '{ printf "%f", $1 / 1024 / 1024 / 1024 }')
network_cost=`echo "$tx_gb" "$TX_RATE" "$rx_gb" "$RX_RATE" | awk '{printf "%f %f", $1*$2, $3*$4}' | awk '{printf "%f", $1 + $2}'`
# Calculate uptime cost