# 停止脚本
#!/bin/bash
#其他服务停止脚步可以通过修改APP_MAIN参数即可
APP_MAIN=com.idoipo.infras.eureka.center.Application
tradePortalPID=
getTradeProtalPID(){
javaps=`$JAVA_HOME/bin/jps -l | grep $APP_MAIN`
if [ -n "$javaps" ]; then
tradePortalPID=`echo $javaps | awk '{print $1}'`
else
tradePortalPID=
fi
}
shutdown(){
getTradeProtalPID
if [ $tradePortalPID -ne ]; then
echo -n "Stopping $APP_MAIN(PID=$tradePortalPID)..."
kill - $tradePortalPID
if [ $? -eq ]; then
echo "[Success]"
else
echo "[Failed]"
fi
getTradeProtalPID
if [ $tradePortalPID -ne ]; then
shutdown
fi
else
echo "$APP_MAIN is not running"
fi
}
shutdown
#启动脚本
#!/bin/bash
#定义启动脚本名字
startFile=center
if [ "$1" == "dev" ]
then
echo "使用dev启动${startFile}应用"
nohup ./${startFile} --spring.profiles.active=dev >/dev/null >& &
else
echo "使用pro启动${startFile}应用"
nohup ./${startFile} --spring.profiles.active=pro >/dev/null >& &
fi