Skip to content

Commit

Permalink
updated init scripts (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonArp authored Jan 28, 2017
1 parent b05c1b9 commit adc3c18
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 9 deletions.
38 changes: 30 additions & 8 deletions rpm/fs/etc/init.d/cluster-aggregator
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit adc3c18

Please sign in to comment.