Unverified Commit 07ad0279 authored by Lex Li's avatar Lex Li Committed by GitHub

[Optimization] Add restartWithJmx option and optimize PID check (#2887)

* Add restartWithJmx option and optimize PID check * Update auto.sh
parent efb76987
...@@ -31,13 +31,13 @@ fi ...@@ -31,13 +31,13 @@ fi
tips() { tips() {
echo "" echo ""
echo "WARNING!!!......Tips, please use command: sh auto.sh [start|startOnPending|startWithJmx|stop|restart|status]. For example: sh auto.sh start " echo "WARNING!!!......Tips, please use command: sh auto.sh [start|startOnPending|startWithJmx|stop|restart|restartWithJmx|status]. For example: sh auto.sh start "
echo "" echo ""
exit 1 exit 1
} }
updatePid() { updatePid() {
pid=$(ps -ef | grep [d]inky | awk '{print $2}' | head -1) pid=$(ps -ef | grep [D]inky | awk '{print $2}' | head -1)
echo $pid >"${PID_PATH}"/${PID_FILE} echo $pid >"${PID_PATH}"/${PID_FILE}
} }
...@@ -68,7 +68,8 @@ startWithJmx() { ...@@ -68,7 +68,8 @@ startWithJmx() {
updatePid updatePid
if [ -z "$pid" ]; then if [ -z "$pid" ]; then
nohup java -Ddruid.mysql.usePingMethod=false -Xms512M -Xmx2048M -XX:PermSize=512M -XX:MaxPermSize=1024M -XX:+HeapDumpOnOutOfMemoryError -Xverify:none "${JMX}" -cp "${CLASS_PATH}" org.dinky.Dinky & nohup java -Ddruid.mysql.usePingMethod=false -Xms512M -Xmx2048M -XX:PermSize=512M -XX:MaxPermSize=1024M -XX:+HeapDumpOnOutOfMemoryError -Xverify:none "${JMX}" -cp "${CLASS_PATH}" org.dinky.Dinky &
echo $! >"${PID_PATH}"/${PID_FILE} # echo $! >"${PID_PATH}"/${PID_FILE}
updatePid
echo "........................................Start Dinky with Jmx Successfully..................................... echo "........................................Start Dinky with Jmx Successfully.....................................
..." ..."
else else
...@@ -110,6 +111,13 @@ restart() { ...@@ -110,6 +111,13 @@ restart() {
echo "........................................Restart Successfully........................................" echo "........................................Restart Successfully........................................"
} }
restartWithJmx() {
echo ""
stop
startWithJmx
echo "........................................Restart with Jmx Successfully........................................"
}
case "$1" in case "$1" in
"start") "start")
start start
...@@ -129,6 +137,9 @@ case "$1" in ...@@ -129,6 +137,9 @@ case "$1" in
"restart") "restart")
restart restart
;; ;;
"restartWithJmx")
restartWithJmx
;;
*) *)
tips tips
;; ;;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment