@@ -16,15 +16,37 @@ user="cagg"
1616prog=" cluster-aggregator"
1717dir=" /opt/cluster-aggregator"
1818log_dir=" $dir /logs"
19- config=" /opt/cluster-aggregator/config/config.hocon"
20- logging_config=" -Dlogback.configurationFile=/opt/cluster-aggregator/config/logback.xml"
2119exec=" /opt/cluster-aggregator/bin/cluster-aggregator"
2220pid_file=" /var/run/cluster-aggregator/cluster-aggregator.pid"
21+ export CONFIG_FILE=" /opt/cluster-aggregator/config/config.hocon"
2322export 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+
2850lockfile=/var/lock/subsys/$prog
2951
3052get_pid () {
@@ -40,13 +62,13 @@ is_running() {
4062}
4163
4264start () {
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
0 commit comments