diff options
-rwxr-xr-x | src/update_power_counter.sh | 6 |
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)"; |