diff --git a/bubble-server/src/main/resources/packer/roles/bubble/files/log_manager.sh b/bubble-server/src/main/resources/packer/roles/bubble/files/log_manager.sh index bf00acea..b3c21f0f 100755 --- a/bubble-server/src/main/resources/packer/roles/bubble/files/log_manager.sh +++ b/bubble-server/src/main/resources/packer/roles/bubble/files/log_manager.sh @@ -24,10 +24,10 @@ if [[ ! -f "${SUPERVISOR_BUBBLE_CONFIG}" ]]; then fi BUBBLE_ERR_LOG=$(awk -F "=" '/stderr_logfile/ {print $2}' ${SUPERVISOR_BUBBLE_CONFIG} | xargs echo) -SUPERVISOR_LOG_FLAG=$(test "${BUBBLE_ERR_LOG}" != "NONE" && echo true || echo false) +SUPERVISOR_LOG_FLAG=$([[ ${BUBBLE_ERR_LOG} != NONE* ]] && echo true || echo false) REDIS_LOG_FLAG_VALUE=$(echo "get ${REDIS_LOG_FLAG_KEY}" | redis-cli | xargs echo | tr '[:upper:]' '[:lower:]') -REDIS_LOG_FLAG=$(test "${REDIS_LOG_FLAG_VALUE}" == "true" && echo true || echo false) +REDIS_LOG_FLAG=$([[ ${REDIS_LOG_FLAG_VALUE} == true ]] && echo true || echo false) function setLoggingForSupervisorConfig { @@ -39,7 +39,7 @@ function setLoggingForSupervisorConfig { if [[ ${line} == std???_logfile* ]]; then if [[ "${logFlag}" == "true" ]]; then # the line should be `std???_logfile = NONE # ` so just remove `NONE #` - echo "${line/_logfile = NONE # /_logfile = /}" >> "${tmpFile}" + echo "${line/_logfile = NONE # /_logfile = }" >> "${tmpFile}" else # truncate current log files: logFile=$(echo "${line}" | awk -F "=" '{print $2}' | xargs echo) @@ -48,9 +48,9 @@ function setLoggingForSupervisorConfig { # remove old logs if any: rm "${logFile}.*" # finally, set NONE got log output in supervisor config file's line: - if [[ ${line} != *NONE* ]]; then + if [[ ${line} != *"_logfile = NONE # "* ]]; then # avoid adding multiple NONE in the line just in case with above test - echo "${line/_logfile = /_logfile = NONE # /}" >> "${tmpFile}" + echo "${line/_logfile = /_logfile = NONE # }" >> "${tmpFile}" else echo "${line}" >> "${tmpFile}" fi