From 92cf064c7f6a6cc82c1a5f87a5fdb0b3b10070b1 Mon Sep 17 00:00:00 2001 From: German Laullon Date: Wed, 6 Dec 2023 11:53:25 +0100 Subject: [PATCH] Update wavefront-proxy --- pkg/etc/init.d/wavefront-proxy | 40 ++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/pkg/etc/init.d/wavefront-proxy b/pkg/etc/init.d/wavefront-proxy index 88e77d446..7a7dee18f 100755 --- a/pkg/etc/init.d/wavefront-proxy +++ b/pkg/etc/init.d/wavefront-proxy @@ -15,14 +15,11 @@ # File any issues here: https://github.com/wavefrontHQ/java/issues. ################################################################################ -service_name="wavefront-proxy" -sysconfig="/etc/sysconfig/$service_name" -[[ -f "$sysconfig" ]] && . $sysconfig - -desc=${DESC:-Wavefront Proxy} -pid_file=${PID_FILE:-/var/run/$service_name.pid} setupEnv(){ + FD=$(ulimit -n) + echo "OS MAX File descriptors: ${FD}" + if [ -f /.dockerenv ]; then >&2 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" >&2 echo "WARNING: Attempting to start Wavefront Proxy as a system daemon in a container environment." @@ -52,7 +49,6 @@ setupEnv(){ user="wavefront" wavefront_dir="/opt/wavefront" proxy_dir=${PROXY_DIR:-$wavefront_dir/wavefront-proxy} - config_dir=${CONFIG_DIR:-/etc/wavefront/wavefront-proxy} conf_file=$CONF_FILE if [[ -z $conf_file ]]; then @@ -69,6 +65,7 @@ setupEnv(){ fi echo "Using \"${conf_file}\" as config file" + mkdir -p /var/log/wavefront/ log_file="/var/log/wavefront/wavefront.log" proxy_jar=${AGENT_JAR:-$proxy_dir/bin/wavefront-proxy.jar} class="com.wavefront.agent.WavefrontProxyService" @@ -95,11 +92,11 @@ jsvc_exec() setupEnv nohup ${JAVA_HOME}/bin/java \ - $java_args \ - -Dlog4j.configurationFile=$config_dir/log4j2.xml \ - -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager \ - -jar $proxy_jar \ - $app_args >> ${log_file} 2>&1 & + $java_args \ + -Dlog4j.configurationFile=$config_dir/log4j2.xml \ + -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager \ + -jar $proxy_jar \ + $app_args >> ${log_file} 2>&1 & echo $! > $pid_file } @@ -148,6 +145,20 @@ condrestart() [ -f "$pid_file" ] && restart || : } +( +echo "#########################" +date + +config_dir=${CONFIG_DIR:-/etc/wavefront/wavefront-proxy} + +service_name="wavefront-proxy" +sysconfig="/etc/sysconfig/$service_name" +[[ -f "$sysconfig" ]] && . $sysconfig + +desc=${DESC:-Wavefront Proxy} +pid_file=${PID_FILE:-/var/run/$service_name.pid} + + case "$1" in start) start ;; status) status ;; @@ -155,6 +166,7 @@ stop) stop ;; restart) restart ;; condrestart) condrestart ;; *) - echo "Usage: $0 {status | start | stop | restart | condrestart}" - exit 1 + echo "Usage: $0 {status | start | stop | restart | condrestart}" + exit 1 esac +) 2>&1 | tee -a /var/log/wf-proxy-boot.log