[ Jan Klepek ]

[ 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
that minimum hours is 1, not 0
This commit is contained in:
Dustin Kirkland 2010-09-14 12:45:34 -06:00
commit 4381d2f519
3 changed files with 11 additions and 2 deletions

7
debian/changelog vendored
View file

@ -1,7 +1,14 @@
byobu (3.5) unreleased; urgency=low byobu (3.5) unreleased; urgency=low
[ Jan Klepek ]
* usr/bin/byobu-status: fix libexec path for Fedora, LP: #630054 * usr/bin/byobu-status: fix libexec path for Fedora, LP: #630054
[ 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
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
byobu (3.4-0ubuntu1) maverick; urgency=low byobu (3.4-0ubuntu1) maverick; urgency=low

View file

@ -74,7 +74,8 @@ 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 /etc/crontab`) / 60 / 60)) hours=$(((`date +%s` - `stat --printf %Z /var/lib`) / 60 / 60))
[ "$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,7 +76,8 @@ 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 /etc/crontab`) / 60 / 60)) hours=$(((`date +%s` - `stat --printf %Z /var/lib`) / 60 / 60))
[ "$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}'`