From 6beb0354a7d4e3d1649cfe7e50fe9f14a291fc44 Mon Sep 17 00:00:00 2001 From: Hechmi Dammak Date: Mon, 16 Oct 2023 15:56:51 +0100 Subject: [PATCH] XM2C-105 remove terminal formatting in echo --- .../docker-entrypoint.d/89-check-validity.sh | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/tomcat-base/src/shared/main/bash/entrypoint/docker-entrypoint.d/89-check-validity.sh b/tomcat-base/src/shared/main/bash/entrypoint/docker-entrypoint.d/89-check-validity.sh index 1bfa814a..6bcaa298 100755 --- a/tomcat-base/src/shared/main/bash/entrypoint/docker-entrypoint.d/89-check-validity.sh +++ b/tomcat-base/src/shared/main/bash/entrypoint/docker-entrypoint.d/89-check-validity.sh @@ -1,14 +1,12 @@ #!/bin/bash currentDate=$(date +%s) -if [ -z "${BUILD_DATE}" ] -then - 1>&2 echo "$(tput -Txterm setaf 3)"'{ "timestamp" : '"$(date -d @$currentDate +"%s")"' ,"severity" : "WARN", "type" : "application","component" : "docker-entrypoint" ,"fullMessage" : "Unable to determine image age: BUILD_DATE is not set"}'"$(tput -Txterm sgr0)" +if [ -z "${BUILD_DATE}" ]; then + echo '{ "timestamp" : '"$(date -d @$currentDate +"%s")"' ,"severity" : "WARN", "type" : "application","component" : "docker-entrypoint" ,"fullMessage" : "Unable to determine image age: BUILD_DATE is not set"}' else - printf -v buildDate "%.0f\n" "$BUILD_DATE" - timeelapsed=`expr ${currentDate} - ${buildDate}` - if [ $timeelapsed -ge 2592000 ] # 30 days - then - 1>&2 echo "$(tput -Txterm setaf 3)"'{ "timestamp" : '"$(date -d @$currentDate +"%s")"' ,"severity" : "WARN", "type" : "application","component" : "docker-entrypoint" , "fullMessage" : "This is an old image: BUILD_DATE='"$(date -d @$BUILD_DATE +"%Y-%m-%d %H:%M:%S")"' and currentDate='"$(date -d @$currentDate +"%Y-%m-%d %H:%M:%S")"'"}'"$(tput -Txterm sgr0)" - fi + printf -v buildDate "%.0f\n" "$BUILD_DATE" + timeelapsed=$(expr ${currentDate} - ${buildDate}) + if [ $timeelapsed -ge 2592000 ]; then # 30 days + echo '{ "timestamp" : '"$(date -d @$currentDate +"%s")"' ,"severity" : "WARN", "type" : "application","component" : "docker-entrypoint" , "fullMessage" : "This is an old image: BUILD_DATE='"$(date -d @$BUILD_DATE +"%Y-%m-%d %H:%M:%S")"' and currentDate='"$(date -d @$currentDate +"%Y-%m-%d %H:%M:%S")"'"}' + fi fi