#!/bin/bash
#author chenyue
echo "member deployment!"
#拿到pid
member_pid=`ps x | grep mutms-member-uat.jar | grep -v grep | awk '{print $1}'`
if [ -z "$member_pid" ];then
#pid不存在直接启动jar
nohup java -jar mutms-member-uat.jar >member.log 2>&1 &
else
#杀掉pid再启动jar
kill -9 $member_pid
nohup java -jar mutms-member-uat.jar >member.log 2>&1 &
fi
echo "member deployment ok!"
-----------------------------------------------------------------------------------------------------------------------
#!/bin/bash
#author chenyue
read -p "请输入jar名称 例: mutms-iservice-sale-uat.jar " jarname
read -p "请输入日志存放名称 例: sale.log " logpath
echo $jarname" deployment!"
#拿到pid
member_pid=`ps x | grep $jarname | grep -v grep | awk '{print $1}'`
if [ -z "$member_pid" ];then
#pid不存在直接启动jar
nohup java -jar $jarname >$logpath 2>&1 &
else
#杀掉pid再启动jar
kill -9 $member_pid
nohup java -jar $jarname >$logpath 2>&1 &
fi
echo $jarname" deployment ok!"
网友评论