Created
May 18, 2016 05:35
-
-
Save dreamkidd/56762a488d921def60c23db39822502f to your computer and use it in GitHub Desktop.
linux 自动部署脚本
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ "root" = `whoami` ]; then | |
echo "请勿使用 root 运行此脚本! 请切换成普通用户!" | |
exit 1 | |
fi | |
source /etc/profile | |
cd ~/mall/ | |
git pull | |
git checkout public | |
echo "=============== 项目打包 =============" | |
mvn clean install -DskipTests | |
echo "=============== 打包完成 =============" | |
cd ~/mall/web-boss | |
echo "=============== 部署 war 包 ===============" | |
process=`ps aux | grep tomcat | grep java | awk '{print $2}'` | |
echo "============== 删除进程:($process) =========" | |
if [ "$process" != "" ]; then | |
kill -9 $process | |
echo "============== 进程已删除 ===========" | |
fi | |
sudo rm -rf ~/apache-tomcat-8.0.33/webapps/ROOT.war | |
sudo rm -rf ~/apache-tomcat-8.0.33/webapps/ROOT/ | |
mv target/web-boss-1.0-SNAPSHOT.war ~/apache-tomcat-8.0.33/webapps/ROOT.war | |
echo "============= 启动 tomcat ==============" | |
cd ~/apache-tomcat-8.0.33 | |
sudo ./bin/startup.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment