From 9063cf16226145833beda33f46da77bc917f4080 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Tue, 14 Sep 2010 14:40:03 -0600 Subject: [PATCH] rather than instance instantiation; use /etc/hostname instead; ensure --- debian/changelog | 2 +- usr/lib/byobu/ec2_cost | 3 +-- usr/lib/byobu/rcs_cost | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index 5e52af1e..1c2347ce 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,7 +6,7 @@ byobu (3.5) unreleased; urgency=low [ Dustin Kirkland ] * usr/lib/byobu/rcs_cost, usr/lib/byobu/ec2_cost: testing crontab 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 -- Dustin Kirkland Wed, 01 Sep 2010 13:11:34 -0600 diff --git a/usr/lib/byobu/ec2_cost b/usr/lib/byobu/ec2_cost index 836771e3..9bc855d0 100755 --- a/usr/lib/byobu/ec2_cost +++ b/usr/lib/byobu/ec2_cost @@ -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}'` # Calculate uptime cost -hours=$(((`date +%s` - `stat --printf %Z /var/lib`) / 60 / 60)) -[ "$hours" = "0" ] && hours=1 +hours=$(((`date +%s` - `stat --printf %Z /etc/hostname`) / 60 / 60 + 1)) uptime_cost=`echo "$hours" | awk "{printf \"%f\", "$RATE" * $hours}"` total_cost=`echo "$network_cost" "$uptime_cost" | awk '{printf "%.2f", $1 + $2}'` diff --git a/usr/lib/byobu/rcs_cost b/usr/lib/byobu/rcs_cost index b7dff716..efe713d2 100755 --- a/usr/lib/byobu/rcs_cost +++ b/usr/lib/byobu/rcs_cost @@ -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}'` # Calculate uptime cost -hours=$(((`date +%s` - `stat --printf %Z /var/lib`) / 60 / 60)) -[ "$hours" = "0" ] && hours=1 +hours=$(((`date +%s` - `stat --printf %Z /etc/hostname`) / 60 / 60 + 1)) uptime_cost=`echo "$hours" | awk "{printf \"%f\", "$MEMORY_RATE" * $hours}"` total_cost=`echo "$network_cost" "$uptime_cost" | awk '{printf "%.2f", $1 + $2}'`