标签:jenkind + git + mave + shell + tomcat
安装所需的插件
Email Extension Plugin GIT plugin Publish Over SSH
安装 maven jdk 配置电子邮件 邮件触发器等 配置登录免秘钥 上一章博客都有
新建Maven项目
pom.xml 开发文件 在git项目中必须有
cd /root/.jenkins/jobs/qq.com/workspace/
tar -jcf qq.com.tar.gz ./*
scp /root/.jenkins/jobs/qq.com/workspace/*.gz root@192.168.80.62:/opt/data/
publish.sh 脚本内容
#!/bin/bash
TOMCAT_HOME="/opt/tomcat"
PROJECT="ROOT"
BAK_DIR=/opt/bak/`date +%Y-%m%-d%-H%-M%-S`
DIR="/opt/tomcat/webapps/ROOT"
#shutdown tomcat
${TOMCAT_HOME}/bin/shutdown.sh
echo "tomcat shutdown"
sleep 3
#publish project
rm -rf "${TOMCAT_HOME}"/webapps/"$PROJECT"/*
cp -r /opt/data/* "${TOMCAT_HOME}"/webapps/"$PROJECT"/
#remove tmp
rm -rf /opt/data/*
cd $DIR
tar -xf *.gz
rm -rf *.gz
#bak project
cp -r "$DIR" "$BAK_DIR"/
#start tomcat
"${TOMCAT_HOME}"/bin/startup.sh
echo "tomcat is starting!"
ok
http://www.thinksaas.cn/topics/0/378/378471.html
jenkind + git + mave + shell + tomcat
标签:jenkind + git + mave + shell + tomcat
原文地址:http://7456193.blog.51cto.com/7446193/1787573