aboutsummaryrefslogtreecommitdiff
path: root/src/update_power_counter.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/update_power_counter.sh')
-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)";