From adc3c182b0ef5d5304eef13a65494e6bdc351624 Mon Sep 17 00:00:00 2001 From: Brandon Arp Date: Fri, 27 Jan 2017 23:08:25 -0800 Subject: [PATCH] updated init scripts (#53) --- rpm/fs/etc/init.d/cluster-aggregator | 38 ++++++++++++++++++++++------ src/main/docker/Dockerfile | 2 +- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/rpm/fs/etc/init.d/cluster-aggregator b/rpm/fs/etc/init.d/cluster-aggregator index 086271f4..21fa09e2 100755 --- a/rpm/fs/etc/init.d/cluster-aggregator +++ b/rpm/fs/etc/init.d/cluster-aggregator @@ -16,15 +16,37 @@ user="cagg" prog="cluster-aggregator" dir="/opt/cluster-aggregator" log_dir="$dir/logs" -config="/opt/cluster-aggregator/config/config.hocon" -logging_config="-Dlogback.configurationFile=/opt/cluster-aggregator/config/logback.xml" exec="/opt/cluster-aggregator/bin/cluster-aggregator" pid_file="/var/run/cluster-aggregator/cluster-aggregator.pid" +export CONFIG_FILE="/opt/cluster-aggregator/config/config.hocon" export JAVA_HOME="$(dirname $(dirname $(readlink -f $(which java))))" -export JAVA_OPTS="$logging_config" +export JVM_XMS="64m" +export JVM_XMX="1024m" +export LOGBACK_CONFIG="-Dlogback.configurationFile=/opt/cluster-aggregator/config/logback.xml" +export ADDITIONAL_JAVA_OPTS="" +export APP_PARAMS="${CONFIG_FILE}" +export ADDITIONAL_APP_PARAMS="" [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog +if [ -z "${JAVA_OPTS}" ]; then + export JAVA_OPTS="${LOGBACK_CONFIG}\ + -XX:+HeapDumpOnOutOfMemoryError \ + -XX:HeapDumpPath=/opt/cluster-aggregator/logs/cluster-aggregator.oom.hprof \ + -XX:+PrintGCDetails \ + -XX:+PrintGCDateStamps \ + -Xloggc:logs/cluster-aggregator.gc.log \ + -XX:NumberOfGCLogFiles=2 \ + -XX:GCLogFileSize=50M \ + -XX:+UseGCLogFileRotation \ + -Xms${JVM_XMS} \ + -Xmx${JVM_XMX} \ + -XX:+UseStringDeduplication \ + -XX:+UseG1GC \ + -Duser.timezone=UTC \ + ${ADDITIONAL_JAVA_OPTS}" +fi + lockfile=/var/lock/subsys/$prog get_pid() { @@ -40,13 +62,13 @@ is_running() { } start() { - [ -f $config ] || exit 6 + [ -f ${CONFIG_FILE} ] || exit 6 echo -n $"Starting $prog: " if is_running; then - warning "$name: already running" + warning "$prog: already running" else cd "$dir" - su "$user" -s /bin/sh -c "$exec $config >> $log_dir/system.out 2>&1 & echo \$! > $pid_file" + su "$user" -s /bin/sh -c "nice $exec ${APP_PARAMS} ${ADDITIONAL_APP_PARAMS} >> $log_dir/system.out 2>&1 & echo \$! > $pid_file" if ! is_running; then failure "$prog did not start" retval=1 @@ -76,7 +98,7 @@ stop() { if is_running; then warning echo - echo -n "Killing $name: " + echo -n "Killing $prog: " kill -9 `get_pid` for i in {1..10} do @@ -104,7 +126,7 @@ stop() { else warning echo - echo "$name: not running" + echo "${prog}: not running" if [ -f "$pid_file" ]; then rm "$pid_file" fi diff --git a/src/main/docker/Dockerfile b/src/main/docker/Dockerfile index 9be0fd41..fa7784ea 100644 --- a/src/main/docker/Dockerfile +++ b/src/main/docker/Dockerfile @@ -41,7 +41,7 @@ ADD lib /opt/cluster-aggregator/lib/ # Entry point CMD JAVA_OPTS="${LOGBACK_CONFIG} \ -XX:+HeapDumpOnOutOfMemoryError \ - -XX:HeapDumpPath=/opt/mad/logs/cluster-aggregator.oom.hprof \ + -XX:HeapDumpPath=/opt/cluster-aggregator/logs/cluster-aggregator.oom.hprof \ -XX:+PrintGCDetails \ -XX:+PrintGCDateStamps \ -Xloggc:logs/cluster-aggregator.gc.log \