#!/bin/bash
app_name=sso-0.0.1-SNAPSHOT.jar
if [ $1 == "start" ]
then
echo "-----do start kesu -----"
nohup java -jar $app_name &
elif [ $1 == "starts" ]
then
echo "-------do start kesu shortly -----"
java -jar $app_name
elif [ $1 == "stop" ]
then
echo "-------do stop kesu -----"
ps -ef | grep $app_name | grep -v grep | awk '{print $2}' | xargs kill -9
elif [ $1 == "restart" ]
then
echo "-------do stop and restart kesu -----"
ps -ef | grep $app_name | grep -v grep | awk '{print $2}' | xargs kill -9
nohup java -jar $app_name &
else
echo "Please make sure the positon variable is start starts restart or stop...."
fi
说明:
脚本.sh start : 后台启动
脚本.sh stop:杀死关闭
脚本.sh starts:前台启动
脚本.sh restart后台重启