Use tabs instead of spaces in rcs_cost

This commit is contained in:
Jon Bernard 2010-04-28 11:31:40 -04:00
commit 97c3df898c

View file

@ -26,12 +26,12 @@ DETAIL=0
PKG="byobu" PKG="byobu"
color 2>/dev/null || color() { true; } color 2>/dev/null || color() { true; }
for arg in "$@"; do for arg in $@; do
case "$arg" in case "$arg" in
-d|--detail) -d|--detail)
DETAIL=1 DETAIL=1
;; ;;
esac esac
done done
# Approximate Instance Cost Basis # Approximate Instance Cost Basis
@ -53,7 +53,7 @@ memory=$((${memory} - (${memory} % (64 * 1024))))
# Apply the going rate # Apply the going rate
INCREMENTS="256 512 1024 2048 4096 8192 16384 32768 65536" INCREMENTS="256 512 1024 2048 4096 8192 16384 32768 65536"
for X in ${INCREMENTS}; do for X in ${INCREMENTS}; do
test "$((${X} * 1024 + 65536))" -ge ${memory} && break test "$((${X} * 1024 + 65536))" -ge ${memory} && break
done done
MEMORY_RATE=`echo "$X" | awk '{printf "%f", $1 / 256 * 15 / 1000}'` MEMORY_RATE=`echo "$X" | awk '{printf "%f", $1 / 256 * 15 / 1000}'`
@ -81,19 +81,19 @@ 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}'`
if [ "$DETAIL" = "1" ]; then if [ "$DETAIL" = "1" ]; then
echo "==========================================================" echo "=========================================================="
echo "Estimated cost in Rackspace Cloud Server since last reboot" echo "Estimated cost in Rackspace Cloud Server since last reboot"
echo "==========================================================" echo "=========================================================="
echo " Network sent: $tx_gb GB @ \$$RX_RATE/GB" echo " Network sent: $tx_gb GB @ \$$RX_RATE/GB"
echo " Network recv: $rx_gb GB @ \$$TX_RATE/GB" echo " Network recv: $rx_gb GB @ \$$TX_RATE/GB"
echo " Network cost: \$$network_cost" echo " Network cost: \$$network_cost"
echo "----------------------------------------------------------" echo "----------------------------------------------------------"
echo " Uptime: $hours hr @ \$$MEMORY_RATE/hr" echo " Uptime: $hours hr @ \$$MEMORY_RATE/hr"
echo " Uptime cost: \$$uptime_cost" echo " Uptime cost: \$$uptime_cost"
echo "----------------------------------------------------------" echo "----------------------------------------------------------"
echo "Total cost: ~\$$total_cost" echo "Total cost: ~\$$total_cost"
echo "==========================================================" echo "=========================================================="
exit 0 exit 0
fi fi
printf "$(color K G)~\$$(color -)$(color b K G)%s$(color -) " $total_cost printf "$(color K G)~\$$(color -)$(color b K G)%s$(color -) " $total_cost