]> gitweb.fluxo.info Git - smartmonster.git/commitdiff
fix small bug where count was zero length string
authorJacob Appelbaum <jacob@appelbaum.net>
Sat, 30 Apr 2011 22:02:22 +0000 (15:02 -0700)
committerJacob Appelbaum <jacob@appelbaum.net>
Sat, 30 Apr 2011 22:02:22 +0000 (15:02 -0700)
src/update_power_counter.sh

index 76ba6f31e93654c090f39c487a2c7c68c2b20a67..785dc1e870b413a15207a1ffcb71174745579ae9 100755 (executable)
@@ -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)";