分类: LINUX
2015-08-07 10:10:13
脚本实现重新部署jar包
需求:
测试服务器有个Java开发的包deploy-0.1.4-SNAPSHOT.jar,因为经常更新,所以需要经常重新部署以方便测试。
每次重新部署的步骤有:
1)杀死deploy-0.1.4-SNAPSHOT.jar进程
2)进到相应目录下删除deploy-0.1.4-SNAPSHOT.jar包
3)从开发服务器(IP为xxx.xxx.xxx.xxx)上下载最新的deploy-0.1.4-SNAPSHOT.jar包
4)重新运行deploy-0.1.4-SNAPSHOT.jar包
为了方便操作,写个脚本如下:
vi runDeploy.sh
# !/bin/bash
# Author: Zheng Haishu
# Date: 2015-08-07
# Function: Reload deploy-0.1.4-SNAPSHOT.jar
# kill deploy process & grep process
kill -9 `ps -ef|grep deploy|grep -v grep|awk '{print $2}'`
cd /home/admin/workspace/
# remove old jar
rm -f deploy-0.1.4-SNAPSHOT.jar
# download new jar
wget "
# execut new jar
java -Xms128m -Xmx1024m -XX:MaxPermSize=512m -jar deploy-0.1.4-SNAPSHOT.jar heren