JVM调优学习总结
程序启动与停止脚本
启动脚本
#!/bin/bash
. /etc/profile
type java >/dev/null 2>&1 || { echo >&2 "java not found, exit now !"; exit 1; }
type jps >/dev/null 2>&1 || { echo >&2 "jps not found, exit now !"; exit 1; }
# make sure app not running
PID=$(jps -ml | grep dahua-service | awk '{print $1}')
if [ ! -z "${PID}" ];then
echo "stop dahua-service ..."
kill -15 ${PID}
sleep 3
PID=$(jps -ml | grep dahua-service | awk '{print $1}')
if [ ! -z "${PID}" ];then
echo "Kill -9 ${PID} ..."
kill -9 ${PID}
fi
fi
cd /data/gateway/dahua
echo "start dahua-service ..."
nohup java -Duser.timezone=GMT+08 -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx256m -Dcom.sun.management.jmxremote.port=59033 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -jar iot-gatewaymgmt-component-dahua-service-0.0.1-SNAPSHOT.jar --server.port=9033 --gw.tcp.server.port=20033 --gw.hd.tcp.server.port=4100 >/dev/null 2>&1 &
sleep 15
PID=$(jps -ml | grep dahua-service | awk '{print $1}')
if [ ! -z "${PID}" ];then
echo "dahua-service is running at ${PID} !"
else
echo "start dahua-service failed !"
fi
停止脚本
一级目录
二级目录
三级目录