ujetl/install_extra/run_copying_job
Derry Hamilton 866d02fb52 Change how log4j finds its config.
log4j is reacting less well to reconfigurations, so this moves the config file location to earlier in the process, so that no class sees an unconfigured instance.
2023-07-11 14:07:37 +01:00

38 lines
866 B
Bash
Executable file

#!/bin/bash
JOBNAME=${1:-undef}
if [ -z "${JOBNAME}" ]
then
echo "Job name not specified"
exit 1
fi
if [ ! -e "/etc/ujetl/${JOBNAME}_config_live.xml" ]
then
echo "Could not find config file for $JOBNAME"
exit 2
fi
LOG_PROPS=/etc/ujetl/copying_defaults_log4j.xml
if [ -e "/etc/ujetl/${JOBNAME}_log4j.xml" ]
then
echo Using log config "/etc/ujetl/${JOBNAME}_log4j.xml"
LOG_PROPS="/etc/ujetl/${JOBNAME}_log4j.xml"
else
echo Using default logging.
fi
#LOCKFILE=/tmp/"${JOBNAME}"_copying.lock
#/usr/bin/lockfile -r ${RETRIES:-"1"} $LOCKFILE || exit 1
#trap "rm -f $LOCKFILE; exit" INT TERM EXIT
/usr/bin/java \
-Xms1g \
-Xmx2g \
-Dlog4j.configuration=file:"$LOG_PROPS" \
-cp /usr/share/ujetl/lib/CopyingApp.jar \
com.rasilon.ujetl.CopyingApp \
--config "/etc/ujetl/${JOBNAME}_config_live.xml"
#rm -f $LOCKFILE