Web System Automation Deployment script

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.