From: Jacob Appelbaum Date: Sat, 30 Apr 2011 22:02:22 +0000 (-0700) Subject: fix small bug where count was zero length string X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=7046434831b74f5edbc11eef091d0adc85ac5cb9;p=smartmonster.git fix small bug where count was zero length string --- 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)";