Ai
1 Star 1 Fork 1

璀璨星辰/shell4jar

forked from chace0120/shell4jar 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
myservice.sh 1.12 KB
一键复制 编辑 原始数据 按行查看 历史
balanar_cx@163.com 提交于 2017-01-17 13:53 +08:00 . 1. 新增jar应用服务化脚本
#!/bin/sh
# chkconfig: 2345 99 10
# description: myservice
source /etc/profile
APP_LOCATION=/www/serviceA.jar
JAVA_OPT="-Xmx512m -Xms512m"
APP_NAME=serviceA
case "$1" in
start)
pid=`ps -ef|grep $APP_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ${pid} ]
then
echo "$APP_NAME is already running"
else
echo "Starting $APP_NAME ..."
nohup java $JAVA_OPT -jar $APP_LOCATION > /dev/null 2>&1 &
fi
;;
stop)
pid=`ps -ef|grep $APP_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ! ${pid} ]
then
echo "$APP_NAME is not running"
else
echo "Stoping $APP_NAME ..."
kill -15 $pid
fi
sleep 1
pid=`ps -ef|grep $APP_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ${pid} ]
then
echo "Kill $APP_NAME !";
kill -9 $pid
else
echo "Stop $APP_NAME Success!"
fi
;;
status)
pid=`ps -ef|grep $APP_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ${pid} ]
then
echo "$APP_NAME is running"
else
echo "$APP_NAME is not running"
fi
;;
*)
echo "Please use start or status or stop as first argument"
;;
esac
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/xpwdm2020/ShellScriptAboutJar.git
git@gitee.com:xpwdm2020/ShellScriptAboutJar.git
xpwdm2020
ShellScriptAboutJar
shell4jar
master

搜索帮助