标签:
以部署在linux系统/opt/Server目录下的Server.jar为例
1.在run.sh启动脚本中添加jvm参数:
-XX:OnOutOfMemoryError=/opt/Server/restart.sh
2.restart.sh脚本
linux环境:
#!/bin/bash
pid=$(ps -ef|grep Server.jar|awk ‘{if($8=="java") {print $2}}‘)
kill -9 $pid
cd /opt/Server/;sh run.sh
Windows环境:
echo off
wmic process where Name=‘java.exe‘ delete
cd D:\Server
start run.bat
标签:
原文地址:http://www.cnblogs.com/dragoonrl/p/4625434.html