jar包自动启动脚本

本地直接启动jar包部署

# Restart Jar Server

#

# Auto start Server !

#

# By wxu 2019-02-26

#

 

app=`ls *.jar`

 

thePid=`ps -ef|grep ${app}|grep -v grep|awk '{print $2}'`

 

kill -9 ${thePid}

 

echo kill Pid:[ ${thePid} ] for [ ${app} ] OK!

# 指定使用prod配置

nohup java -jar -Dspring.profiles.active=prod ${app} &

 

echo ${app} was started!

 

docker启动jar包部署

# Restart Jar Server

#

# Auto start Server !

#

#

# By wxu 2019-02-26

#

 

app=`ls *.jar`

 

name=`echo ${app%-*} | tr 'A-Z' 'a-z'`

 

docker stop ${name}

 

docker rm ${name}

 

docker run -it -d -v $PWD:/opt --name ${name} -e TZ=Asia/Shanghai --net=host java java -jar /opt/${app}

 

echo ${app} was started!

 

 

你可能感兴趣的:(服务器,docker,自动脚本)