aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJacob Appelbaum <jacob@appelbaum.net>2011-04-30 15:02:22 -0700
committerJacob Appelbaum <jacob@appelbaum.net>2011-04-30 15:02:22 -0700
commit7046434831b74f5edbc11eef091d0adc85ac5cb9 (patch)
tree2d5311762d56a62c58d8fae649cbd1877fbb5856 /src
parent80a85944d9a401db0f9f0f8130f88b000a3572ea (diff)
downloadsmartmonster-7046434831b74f5edbc11eef091d0adc85ac5cb9.tar.gz
smartmonster-7046434831b74f5edbc11eef091d0adc85ac5cb9.tar.bz2
fix small bug where count was zero length string
Diffstat (limited to 'src')
-rwxr-xr-xsrc/update_power_counter.sh6
1 files changed, 5 insertions, 1 deletions
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)";