@@ -16,15 +16,37 @@ user="cagg"
16
16
prog=" cluster-aggregator"
17
17
dir=" /opt/cluster-aggregator"
18
18
log_dir=" $dir /logs"
19
- config=" /opt/cluster-aggregator/config/config.hocon"
20
- logging_config=" -Dlogback.configurationFile=/opt/cluster-aggregator/config/logback.xml"
21
19
exec=" /opt/cluster-aggregator/bin/cluster-aggregator"
22
20
pid_file=" /var/run/cluster-aggregator/cluster-aggregator.pid"
21
+ export CONFIG_FILE=" /opt/cluster-aggregator/config/config.hocon"
23
22
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=" "
25
29
26
30
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
27
31
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
+
28
50
lockfile=/var/lock/subsys/$prog
29
51
30
52
get_pid () {
@@ -40,13 +62,13 @@ is_running() {
40
62
}
41
63
42
64
start () {
43
- [ -f $config ] || exit 6
65
+ [ -f ${CONFIG_FILE} ] || exit 6
44
66
echo -n $" Starting $prog : "
45
67
if is_running; then
46
- warning " $name : already running"
68
+ warning " $prog : already running"
47
69
else
48
70
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 "
50
72
if ! is_running; then
51
73
failure " $prog did not start"
52
74
retval=1
@@ -76,7 +98,7 @@ stop() {
76
98
if is_running; then
77
99
warning
78
100
echo
79
- echo -n " Killing $name : "
101
+ echo -n " Killing $prog : "
80
102
kill -9 ` get_pid`
81
103
for i in {1..10}
82
104
do
@@ -104,7 +126,7 @@ stop() {
104
126
else
105
127
warning
106
128
echo
107
- echo " $name : not running"
129
+ echo " ${prog} : not running"
108
130
if [ -f " $pid_file " ]; then
109
131
rm " $pid_file "
110
132
fi
0 commit comments