rather than instance instantiation; use /etc/hostname instead; ensure

This commit is contained in:
Dustin Kirkland 2010-09-14 14:40:03 -06:00
commit 9063cf1622
3 changed files with 3 additions and 5 deletions

2
debian/changelog vendored
View file

@ -6,7 +6,7 @@ byobu (3.5) unreleased; urgency=low
[ Dustin Kirkland ] [ Dustin Kirkland ]
* usr/lib/byobu/rcs_cost, usr/lib/byobu/ec2_cost: testing crontab * usr/lib/byobu/rcs_cost, usr/lib/byobu/ec2_cost: testing crontab
creation time is not accurate, seems this happens at image creation creation time is not accurate, seems this happens at image creation
rather than instance instantiation; use /var/lib instead; ensure rather than instance instantiation; use /etc/hostname instead; ensure
that minimum hours is 1, not 0 that minimum hours is 1, not 0
-- Dustin Kirkland <kirkland@ubuntu.com> Wed, 01 Sep 2010 13:11:34 -0600 -- Dustin Kirkland <kirkland@ubuntu.com> Wed, 01 Sep 2010 13:11:34 -0600

View file

@ -74,8 +74,7 @@ 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}'` 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 # Calculate uptime cost
hours=$(((`date +%s` - `stat --printf %Z /var/lib`) / 60 / 60)) hours=$(((`date +%s` - `stat --printf %Z /etc/hostname`) / 60 / 60 + 1))
[ "$hours" = "0" ] && hours=1
uptime_cost=`echo "$hours" | awk "{printf \"%f\", "$RATE" * $hours}"` uptime_cost=`echo "$hours" | awk "{printf \"%f\", "$RATE" * $hours}"`
total_cost=`echo "$network_cost" "$uptime_cost" | awk '{printf "%.2f", $1 + $2}'` total_cost=`echo "$network_cost" "$uptime_cost" | awk '{printf "%.2f", $1 + $2}'`

View file

@ -76,8 +76,7 @@ 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}'` 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 # Calculate uptime cost
hours=$(((`date +%s` - `stat --printf %Z /var/lib`) / 60 / 60)) hours=$(((`date +%s` - `stat --printf %Z /etc/hostname`) / 60 / 60 + 1))
[ "$hours" = "0" ] && hours=1
uptime_cost=`echo "$hours" | awk "{printf \"%f\", "$MEMORY_RATE" * $hours}"` uptime_cost=`echo "$hours" | awk "{printf \"%f\", "$MEMORY_RATE" * $hours}"`
total_cost=`echo "$network_cost" "$uptime_cost" | awk '{printf "%.2f", $1 + $2}'` total_cost=`echo "$network_cost" "$uptime_cost" | awk '{printf "%.2f", $1 + $2}'`