Skip to content

Commit adc3c18

Browse files
authored
updated init scripts (#53)
1 parent b05c1b9 commit adc3c18

File tree

2 files changed

+31
-9
lines changed

2 files changed

+31
-9
lines changed

rpm/fs/etc/init.d/cluster-aggregator

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,37 @@ user="cagg"
1616
prog="cluster-aggregator"
1717
dir="/opt/cluster-aggregator"
1818
log_dir="$dir/logs"
19-
config="/opt/cluster-aggregator/config/config.hocon"
20-
logging_config="-Dlogback.configurationFile=/opt/cluster-aggregator/config/logback.xml"
2119
exec="/opt/cluster-aggregator/bin/cluster-aggregator"
2220
pid_file="/var/run/cluster-aggregator/cluster-aggregator.pid"
21+
export CONFIG_FILE="/opt/cluster-aggregator/config/config.hocon"
2322
export JAVA_HOME="$(dirname $(dirname $(readlink -f $(which java))))"
24-
export JAVA_OPTS="$logging_config"
23+
export JVM_XMS="64m"
24+
export JVM_XMX="1024m"
25+
export LOGBACK_CONFIG="-Dlogback.configurationFile=/opt/cluster-aggregator/config/logback.xml"
26+
export ADDITIONAL_JAVA_OPTS=""
27+
export APP_PARAMS="${CONFIG_FILE}"
28+
export ADDITIONAL_APP_PARAMS=""
2529

2630
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
2731

32+
if [ -z "${JAVA_OPTS}" ]; then
33+
export JAVA_OPTS="${LOGBACK_CONFIG}\
34+
-XX:+HeapDumpOnOutOfMemoryError \
35+
-XX:HeapDumpPath=/opt/cluster-aggregator/logs/cluster-aggregator.oom.hprof \
36+
-XX:+PrintGCDetails \
37+
-XX:+PrintGCDateStamps \
38+
-Xloggc:logs/cluster-aggregator.gc.log \
39+
-XX:NumberOfGCLogFiles=2 \
40+
-XX:GCLogFileSize=50M \
41+
-XX:+UseGCLogFileRotation \
42+
-Xms${JVM_XMS} \
43+
-Xmx${JVM_XMX} \
44+
-XX:+UseStringDeduplication \
45+
-XX:+UseG1GC \
46+
-Duser.timezone=UTC \
47+
${ADDITIONAL_JAVA_OPTS}"
48+
fi
49+
2850
lockfile=/var/lock/subsys/$prog
2951

3052
get_pid() {
@@ -40,13 +62,13 @@ is_running() {
4062
}
4163

4264
start() {
43-
[ -f $config ] || exit 6
65+
[ -f ${CONFIG_FILE} ] || exit 6
4466
echo -n $"Starting $prog: "
4567
if is_running; then
46-
warning "$name: already running"
68+
warning "$prog: already running"
4769
else
4870
cd "$dir"
49-
su "$user" -s /bin/sh -c "$exec $config >> $log_dir/system.out 2>&1 & echo \$! > $pid_file"
71+
su "$user" -s /bin/sh -c "nice $exec ${APP_PARAMS} ${ADDITIONAL_APP_PARAMS} >> $log_dir/system.out 2>&1 & echo \$! > $pid_file"
5072
if ! is_running; then
5173
failure "$prog did not start"
5274
retval=1
@@ -76,7 +98,7 @@ stop() {
7698
if is_running; then
7799
warning
78100
echo
79-
echo -n "Killing $name: "
101+
echo -n "Killing $prog: "
80102
kill -9 `get_pid`
81103
for i in {1..10}
82104
do
@@ -104,7 +126,7 @@ stop() {
104126
else
105127
warning
106128
echo
107-
echo "$name: not running"
129+
echo "${prog}: not running"
108130
if [ -f "$pid_file" ]; then
109131
rm "$pid_file"
110132
fi

src/main/docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ ADD lib /opt/cluster-aggregator/lib/
4141
# Entry point
4242
CMD JAVA_OPTS="${LOGBACK_CONFIG} \
4343
-XX:+HeapDumpOnOutOfMemoryError \
44-
-XX:HeapDumpPath=/opt/mad/logs/cluster-aggregator.oom.hprof \
44+
-XX:HeapDumpPath=/opt/cluster-aggregator/logs/cluster-aggregator.oom.hprof \
4545
-XX:+PrintGCDetails \
4646
-XX:+PrintGCDateStamps \
4747
-Xloggc:logs/cluster-aggregator.gc.log \

0 commit comments

Comments
 (0)