@@ -56,34 +56,34 @@ function extract_java_version {
56
56
# }
57
57
58
58
function get_pid {
59
- local ppid=" "
60
- if [ -f ${EVENTMESH_ADMIN_HOME} /bin/pid-admin.file ]; then
61
- ppid=$( cat ${EVENTMESH_ADMIN_HOME} /bin/pid-admin.file)
62
- # If the process does not exist, it indicates that the previous process terminated abnormally.
59
+ local ppid=" "
60
+ if [ -f ${EVENTMESH_ADMIN_HOME} /bin/pid-admin.file ]; then
61
+ ppid=$( cat ${EVENTMESH_ADMIN_HOME} /bin/pid-admin.file)
62
+ # If the process does not exist, it indicates that the previous process terminated abnormally.
63
63
if [ ! -d /proc/$ppid ]; then
64
64
# Remove the residual file.
65
65
rm ${EVENTMESH_ADMIN_HOME} /bin/pid-admin.file
66
66
echo -e " ERROR\t EventMesh process had already terminated unexpectedly before, please check log output."
67
67
ppid=" "
68
68
fi
69
- else
70
- if [[ $OS =~ Msys ]]; then
71
- # There is a Bug on Msys that may not be able to kill the identified process
72
- ppid=` jps -v | grep -i " org.apache.eventmesh.admin.server.ExampleAdminServer" | grep java | grep -v grep | awk -F ' ' {' print $1' }`
73
- elif [[ $OS =~ Darwin ]]; then
74
- # Known problem: grep Java may not be able to accurately identify Java processes
75
- ppid=$( /bin/ps -o user,pid,command | grep " java" | grep -i " org.apache.eventmesh.admin.server.ExampleAdminServer" | grep -Ev " ^root" | awk -F ' ' {' print $2' })
76
- else
77
- if [ $DOCKER ]; then
78
- # No need to exclude root user in Docker containers.
79
- ppid=$( ps -C java -o user,pid,command --cols 99999 | grep -w $EVENTMESH_ADMIN_HOME | grep -i " org.apache.eventmesh.admin.server.ExampleAdminServer" | awk -F ' ' {' print $2' })
80
- else
69
+ else
70
+ if [[ $OS =~ Msys ]]; then
71
+ # There is a Bug on Msys that may not be able to kill the identified process
72
+ ppid=` jps -v | grep -i " org.apache.eventmesh.admin.server.ExampleAdminServer" | grep java | grep -v grep | awk -F ' ' {' print $1' }`
73
+ elif [[ $OS =~ Darwin ]]; then
74
+ # Known problem: grep Java may not be able to accurately identify Java processes
75
+ ppid=$( /bin/ps -o user,pid,command | grep " java" | grep -i " org.apache.eventmesh.admin.server.ExampleAdminServer" | grep -Ev " ^root" | awk -F ' ' {' print $2' })
76
+ else
77
+ if [ $DOCKER ]; then
78
+ # No need to exclude root user in Docker containers.
79
+ ppid=$( ps -C java -o user,pid,command --cols 99999 | grep -w $EVENTMESH_ADMIN_HOME | grep -i " org.apache.eventmesh.admin.server.ExampleAdminServer" | awk -F ' ' {' print $2' })
80
+ else
81
81
# It is required to identify the process as accurately as possible on Linux.
82
82
ppid=$( ps -C java -o user,pid,command --cols 99999 | grep -w $EVENTMESH_ADMIN_HOME | grep -i " org.apache.eventmesh.admin.server.ExampleAdminServer" | grep -Ev " ^root" | awk -F ' ' {' print $2' })
83
83
fi
84
- fi
85
- fi
86
- echo " $ppid " ;
84
+ fi
85
+ fi
86
+ echo " $ppid " ;
87
87
}
88
88
89
89
# ===========================================================================================
@@ -136,8 +136,7 @@ export JAVA_HOME
136
136
137
137
GC_LOG_FILE=" ${EVENTMESH_ADMIN_LOG_HOME} /eventmesh_admin_gc_%p.log"
138
138
139
- # JAVA_OPT="${JAVA_OPT} -server -Xms2048M -Xmx4096M -Xmn2048m -XX:SurvivorRatio=4"
140
- JAVA_OPT=` cat ${EVENTMESH_ADMIN_HOME} /conf/server.env | grep APP_START_JVM_OPTION::: | awk -F ' :::' {' print $2' }`
139
+ JAVA_OPT=" ${JAVA_OPT} -server -Xms1g -Xmx1g"
141
140
JAVA_OPT=" ${JAVA_OPT} -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 -XX:SoftRefLRUPolicyMSPerMB=0 -XX:SurvivorRatio=8 -XX:MaxGCPauseMillis=50"
142
141
JAVA_OPT=" ${JAVA_OPT} -verbose:gc"
143
142
if [[ " $JAVA_VERSION " == " 8" ]]; then
@@ -172,7 +171,7 @@ JAVA_OPT="${JAVA_OPT} -DeventMeshPluginDir=${EVENTMESH_ADMIN_HOME}/plugin"
172
171
# echo "proxy is running already"
173
172
# exit 9;
174
173
# else
175
- # echo "err pid$pid, rm pid.file"
174
+ # echo "err pid$pid, rm pid.file"
176
175
# rm pid.file
177
176
# fi
178
177
# fi
@@ -183,8 +182,8 @@ if [[ $pid == "ERROR"* ]]; then
183
182
exit 9
184
183
fi
185
184
if [ -n " $pid " ]; then
186
- echo -e " ERROR\t The server is already running (pid=$pid ), there is no need to execute start.sh again."
187
- exit 9
185
+ echo -e " ERROR\t The server is already running (pid=$pid ), there is no need to execute start.sh again."
186
+ exit 9
188
187
fi
189
188
190
189
make_logs_dir
@@ -193,9 +192,9 @@ echo "Using Java version: $JAVA_VERSION, path: $JAVA" >> ${EVENTMESH_ADMIN_LOG_H
193
192
194
193
EVENTMESH_ADMIN_MAIN=org.apache.eventmesh.admin.server.ExampleAdminServer
195
194
if [ $DOCKER ]; then
196
- $JAVA $JAVA_OPT -classpath ${EVENTMESH_ADMIN_HOME} /conf:${EVENTMESH_ADMIN_HOME} /apps/* :${EVENTMESH_ADMIN_HOME} /lib/* $EVENTMESH_ADMIN_MAIN >> ${EVENTMESH_ADMIN_LOG_HOME} /eventmesh-admin.out
195
+ $JAVA $JAVA_OPT -classpath ${EVENTMESH_ADMIN_HOME} /conf:${EVENTMESH_ADMIN_HOME} /apps/* :${EVENTMESH_ADMIN_HOME} /lib/* $EVENTMESH_ADMIN_MAIN >> ${EVENTMESH_ADMIN_LOG_HOME} /eventmesh-admin.out
197
196
else
198
- $JAVA $JAVA_OPT -classpath ${EVENTMESH_ADMIN_HOME} /conf:${EVENTMESH_ADMIN_HOME} /apps/* :${EVENTMESH_ADMIN_HOME} /lib/* $EVENTMESH_ADMIN_MAIN >> ${EVENTMESH_ADMIN_LOG_HOME} /eventmesh-admin.out 2>&1 &
197
+ $JAVA $JAVA_OPT -classpath ${EVENTMESH_ADMIN_HOME} /conf:${EVENTMESH_ADMIN_HOME} /apps/* :${EVENTMESH_ADMIN_HOME} /lib/* $EVENTMESH_ADMIN_MAIN >> ${EVENTMESH_ADMIN_LOG_HOME} /eventmesh-admin.out 2>&1 &
199
198
echo $! > ${EVENTMESH_ADMIN_HOME} /bin/pid-admin.file
200
199
fi
201
200
exit 0
0 commit comments