From 7046434831b74f5edbc11eef091d0adc85ac5cb9 Mon Sep 17 00:00:00 2001 From: Jacob Appelbaum Date: Sat, 30 Apr 2011 15:02:22 -0700 Subject: fix small bug where count was zero length string --- src/update_power_counter.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/update_power_counter.sh b/src/update_power_counter.sh index 76ba6f3..785dc1e 100755 --- a/src/update_power_counter.sh +++ b/src/update_power_counter.sh @@ -47,7 +47,11 @@ then echo $CURRENT_POWER_COUNT > $PREVIOUS_POWER_COUNT_FILE; echo $PREVIOUS_POWER_COUNT=$CURRENT_POWER_COUNT; else - PREVIOUS_POWER_COUNT="`cat $STATE_DIR/previous_power_count`"; + PREVIOUS_POWER_COUNT="`cat $PREVIOUS_POWER_COUNT_FILE`"; + if [ -z $PREVIOUS_POWER_COUNT ]; + then + PREVIOUS_POWER_COUNT=$CURRENT_POWER_COUNT; + fi fi EXPECTED_NEXT_COUNT="$(expr $CURRENT_POWER_COUNT + $POWER_INCREMENT)"; -- cgit v1.2.3