mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-09-03 06:19:37 +00:00
perf[deploy]: reduce deployment complexity
This commit is contained in:
@@ -52,6 +52,10 @@
|
||||
####################################################################################################################################################################################
|
||||
# @author godotg
|
||||
|
||||
## java command path
|
||||
JAVA_HOME="/usr/local/java/bin"
|
||||
JAVA_JVM_OPTIONS="-Dspring.profiles.active=pro -XX:InitialHeapSize=1g -XX:MaxHeapSize=1g -XX:AutoBoxCacheMax=20000 -XX:+UseStringDeduplication -XX:+HeapDumpOnOutOfMemoryError -Djdk.attach.allowAttachSelf=true -Duser.timezone=Asia/Shanghai -Dfile.encoding=UTF-8"
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "deploy.sh script use error, command parameter is illegal"
|
||||
echo "usage: sh deploy.sh start|stop|update|stopUpdateStart"
|
||||
@@ -66,7 +70,7 @@ source /etc/profile
|
||||
function waitAllProcessesExit() {
|
||||
while true; do
|
||||
local runningProcesses
|
||||
runningProcesses=$(jps -lvm | grep ${1})
|
||||
runningProcesses=$(${JAVA_HOME}/jps -lvm | grep ${1})
|
||||
|
||||
if [ -n "${runningProcesses}" ]; then
|
||||
echo "The following Java processes are being shut down ${1}:"
|
||||
@@ -142,7 +146,7 @@ function waitLogFile() {
|
||||
function stop() {
|
||||
echo "######################################################################################################################### Ⅰ stop #########################################################################################################################"
|
||||
local pids
|
||||
pids=$(jps | grep ${1} | awk '{print $1}' | paste -d " " -s)
|
||||
pids=$(${JAVA_HOME}/jps | grep ${1} | awk '{print $1}' | paste -d " " -s)
|
||||
|
||||
if [ -z "${pids}" ]; then
|
||||
echo "Did not find any Java process containing the ${1} keyword"
|
||||
@@ -173,7 +177,7 @@ function stop() {
|
||||
echo "************************************* jmap *************************************"
|
||||
for pid in ${pids}; do
|
||||
echo "${pid}->Information about the top 20 class instances of the process"
|
||||
jmap -histo ${pid} | head -n 5
|
||||
${JAVA_HOME}/jmap -histo ${pid} | head -n 5
|
||||
echo -e "\n"
|
||||
done
|
||||
|
||||
@@ -246,7 +250,8 @@ function start() {
|
||||
|
||||
# -XX:+AlwaysPreTouch,并置零内存页面,可能令得启动时慢上一点,但后面访问时会更流畅,比如页面会连续分配
|
||||
# 输出到文件 >> output.log 2>&1 &
|
||||
nohup java -Dspring.profiles.active=pro -XX:InitialHeapSize=1g -XX:MaxHeapSize=1g -XX:AutoBoxCacheMax=20000 -XX:+UseStringDeduplication -XX:+HeapDumpOnOutOfMemoryError -Djdk.attach.allowAttachSelf=true -Duser.timezone=Asia/Shanghai -Dfile.encoding=UTF-8 -jar ${jarPath} >/dev/null 2>&1 &
|
||||
echo "${JAVA_HOME}/java ${JAVA_JVM_OPTIONS} -jar ${jarPath} >/dev/null 2>&1 &"
|
||||
nohup ${JAVA_HOME}/java ${JAVA_JVM_OPTIONS} -jar ${jarPath} >/dev/null 2>&1 &
|
||||
|
||||
# If there is no info log, keep waiting
|
||||
waitLogFile
|
||||
|
||||
Reference in New Issue
Block a user