7
7
# statistics on data and forwards them to upstream aggregation \
8
8
# services
9
9
# processname: mad
10
- # config: /opt/mad/config/config.json
10
+ # config: /opt/mad/config/config.hocon
11
11
# pidfile: /var/run/mad/mad.pid
12
12
13
13
# Source function library.
@@ -17,15 +17,37 @@ user="mad"
17
17
prog=" mad"
18
18
dir=" /opt/mad"
19
19
log_dir=" $dir /logs"
20
- config=" /opt/mad/config/config.json"
21
- logging_config=" -Dlogback.configurationFile=/opt/mad/config/logback.xml"
22
20
exec=" /opt/mad/bin/mad"
23
21
pid_file=" /var/run/mad/mad.pid"
22
+ export CONFIG_FILE=" /opt/mad/config/config.hocon"
24
23
export JAVA_HOME=" $( dirname $( dirname $( readlink -f $( which java) ) ) ) "
25
- export JAVA_OPTS=" $logging_config "
24
+ export JVM_XMS=" 64m"
25
+ export JVM_XMX=" 1024m"
26
+ export LOGBACK_CONFIG=" -Dlogback.configurationFile=/opt/mad/config/logback.xml"
27
+ export ADDITIONAL_JAVA_OPTS=" "
28
+ export APP_PARAMS=" ${CONFIG_FILE} "
29
+ export ADDITIONAL_APP_PARAMS=" "
26
30
27
31
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
28
32
33
+ if [ -z " $JAVA_OPTS " ]; then
34
+ export JAVA_OPTS=" ${LOGBACK_CONFIG} \
35
+ -XX:+HeapDumpOnOutOfMemoryError \
36
+ -XX:HeapDumpPath=/opt/mad/logs/mad.oom.hprof \
37
+ -XX:+PrintGCDetails \
38
+ -XX:+PrintGCDateStamps \
39
+ -Xloggc:logs/mad.gc.log \
40
+ -XX:NumberOfGCLogFiles=2 \
41
+ -XX:GCLogFileSize=50M \
42
+ -XX:+UseGCLogFileRotation \
43
+ -Xms${JVM_XMS} \
44
+ -Xmx${JVM_XMX} \
45
+ -XX:+UseStringDeduplication \
46
+ -XX:+UseG1GC \
47
+ -Duser.timezone=UTC \
48
+ ${ADDITIONAL_JAVA_OPTS} "
49
+ fi
50
+
29
51
lockfile=/var/lock/subsys/$prog
30
52
31
53
get_pid () {
@@ -41,13 +63,13 @@ is_running() {
41
63
}
42
64
43
65
start () {
44
- [ -f $config ] || exit 6
66
+ [ -f $CONFIG_FILE ] || exit 6
45
67
echo -n $" Starting $prog : "
46
68
if is_running; then
47
- warning " $name : already running"
69
+ warning " $prog : already running"
48
70
else
49
71
cd " $dir "
50
- su " $user " -s /bin/sh -c " nice $exec $config >> $log_dir /system.out 2>&1 & echo \$ ! > $pid_file "
72
+ su " $user " -s /bin/sh -c " nice $exec ${APP_PARAMS} ${ADDITIONAL_APP_PARAMS} >> $log_dir /system.out 2>&1 & echo \$ ! > $pid_file "
51
73
if ! is_running; then
52
74
failure " $prog did not start"
53
75
retval=1
@@ -77,7 +99,7 @@ stop() {
77
99
if is_running; then
78
100
warning
79
101
echo
80
- echo -n " Killing $name : "
102
+ echo -n " Killing $prog : "
81
103
kill -9 ` get_pid`
82
104
for i in {1..10}
83
105
do
@@ -105,7 +127,7 @@ stop() {
105
127
else
106
128
warning
107
129
echo
108
- echo " $name : not running"
130
+ echo " $prog : not running"
109
131
if [ -f " $pid_file " ]; then
110
132
rm " $pid_file "
111
133
fi
0 commit comments