1 Star 1 Fork 1

璀璨星辰/shell4jar

forked from chace0120/shell4jar 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
service-check.sh 962 Bytes
一键复制 编辑 原始数据 按行查看 历史
balanar_cx@163.com 提交于 2017-01-17 13:53 +08:00 . 1. 新增jar应用服务化脚本
#!/bin/sh
source /etc/profile
CK_LOG=/www/service_check.log
for i in {0..1}
do
if [ $i == 0 ]
then
app_location=/www/serviceA.jar
app_name=serviceA
opt_xmx='-Xmx512m'
opt_xms='-Xms512m'
elif [ $i == 1 ]
then
app_location=/www/serviceB.jar
app_name=serviceB
opt_xmx='-Xmx512m'
opt_xms='-Xms512m'
fi
tpid=`ps -ef|grep $app_name|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ! ${tpid} ]
then
curdatetime=$(date '+%Y-%m-%d %T')
echo '====== Service Check Time: '${curdatetime} >> $CK_LOG
echo ${app_name}' is not running.' >> $CK_LOG
echo 'try to restart '${app_name}' ...' >> $CK_LOG
nohup java $opt_xmx $opt_xms -jar $app_location >/dev/null 2>&1 &
tpid=`ps -ef|grep $app_name|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ${tpid} ]; then
echo 'restart '${app_name}' success!' >> $CK_LOG
else
echo 'restart '${app_name}' error!' >> $CK_LOG
fi
fi
done
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/xpwdm2020/ShellScriptAboutJar.git
git@gitee.com:xpwdm2020/ShellScriptAboutJar.git
xpwdm2020
ShellScriptAboutJar
shell4jar
master

搜索帮助