Web development projects, in addition to running locally, may often require deployment on the server.
A script for automating deployment is written for informational purposes only.
There are many places where you need to configure a path, and a personal recommendation to use an absolute path without relying on the path where the script was executed.
#!/bin/sh
#删除源代码目录, update the latest code again
Echo ' Delete git project dir '
RM-RF Project
Echo ' Delete Project done '
Echo ' Start clone git project '
git clone http://git.company.com/project.git
If [$?-eq 0];then
echo ' git clone ok! ';
Else
Echo ' git clone failed!!! ';
Exit
Fi
#使用maven打包
CD Project
MVN install-dmaven.test.skip=true
If [$?-eq 0];then
Echo ' mvn install ok! ';
Else
Echo ' MVN install failed!!! ';
Exit
Fi
#复制war包到Tomcat的webapps目录
path=~/tomcat7/webapps/
Srcpath=~/source
Echo $srcPath
Echo $path
CP $srcPath/login-center/target/login-center.war $path/login-center.war
echo ' Copy file Login-center.war done '
#重启Tomcat
./shutdown.sh
./startup.sh
Web system Automation Deployment scripts