From 1b800cc780fb50ad9330a80cda73bc307d479334 Mon Sep 17 00:00:00 2001 From: David Coutadeur Date: Thu, 16 May 2024 18:26:54 +0200 Subject: [PATCH] fix confdir when computing static or dynamic temporary log directory (#95) --- bin/lsc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bin/lsc b/bin/lsc index 4ae001fb..f9aabae3 100755 --- a/bin/lsc +++ b/bin/lsc @@ -60,8 +60,16 @@ fi CFG_DIR="$LSC_HOME/etc" LIB_DIR="$LSC_HOME/lib" +# Get configuration directory from command line +cfg_dir="${CFG_DIR}" # default value +while getopts "f:" opt > /dev/null 2>&1; do + case "${opt}" in + f) cfg_dir=${OPTARG} + ;; + esac +done # Get logdir property from logback.xml -logdir=$( grep 'property[ ]\+name="logdir"' "${CFG_DIR}/logback.xml" | sed -e 's/^.*value="\([^"]*\)".*$/\1/' ) +logdir=$( grep 'property[ ]\+name="logdir"' "${cfg_dir}/logback.xml" | sed -e 's/^.*value="\([^"]*\)".*$/\1/' ) if [ "${logdir}" = "\${TMP_DIR}" ] || [ "${logdir}" = "\$TMP_DIR" ]; then # Create temp directory LOG_DIR="$( mktemp -d /tmp/lsc-$(date +%Y-%M-%d-%T).XXXXXXXXXX )"