Skip to content

Commit

Permalink
Update wavefront-proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
laullon authored Dec 6, 2023
1 parent ecdccf9 commit 92cf064
Showing 1 changed file with 26 additions and 14 deletions.
40 changes: 26 additions & 14 deletions pkg/etc/init.d/wavefront-proxy
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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
}
Expand Down Expand Up @@ -148,13 +145,28 @@ 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 ;;
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

0 comments on commit 92cf064

Please sign in to comment.