<commit_before>#!/bin/bash

exit 0

: ${FIREWALLA_HOME:=/home/pi/firewalla}
source ${FIREWALLA_HOME}/platform/platform.sh

# hide script normal output to log, only show error
exec > /tmp/13_redis_config_maxmemory.log

redis_run() {
    su - redis -s /bin/bash -c "$@"
}
redis_run "redis-cli config set maxmemory ${REDIS_MAXMEMORY:-0}"
redis_run "redis-cli config rewrite"
redis_run "redis-cli config get maxmemory"<commit_msg>reset maxmemory to 0 if already set to none-zero<commit_after>#!/bin/bash

exit 0

: ${FIREWALLA_HOME:=/home/pi/firewalla}
source ${FIREWALLA_HOME}/platform/platform.sh

# hide script normal output to log, only show error
exec > /tmp/13_redis_config_maxmemory.log

redis_run() {
    su - redis -s /bin/bash -c "$@"
}

CUR_VALUE=$(redis-cli config get maxmemory | tail -n 1)

# reset to 0 if already set to none-zero by previous legacy code
if [[ "$CUR_VALUE" -ne 0 ]]; then
  redis_run "redis-cli config set maxmemory 0"
fi

exit 0

redis_run "redis-cli config set maxmemory ${REDIS_MAXMEMORY:-0}"
redis_run "redis-cli config rewrite"
redis_run "redis-cli config get maxmemory"
{'fraction_non_alphanumeric': 0.11967361740707162, 'fraction_numerical': 0.012692656391659111, 'mean_word_length': 4.465346534653466, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4217042', 'n_tokens_mistral': 433, 'n_tokens_neox': 410, 'n_words': 116}