Automating deployment projects with shell scripts under Linux

Source: Internet
Author: User

In the Java development project often to the development of the project to the test server to test, the general is to put the project into a war package, and then publish the war package to the server, shut down the server, and finally restart the server, although this process is not very cumbersome, but if it is a number of projects to be published, The release process will be cumbersome, so the gospel comes ...

By writing a shell script to do this, the project can be automatically published to the server as long as a shell script is executed, and it is still easier to use.

The first step: Install SVN in Linux. (This can refer to another blog:http://simplelife.blog.51cto.com/9954761/1729931 ), specific to this blog, SVN was installed to use some of the commands in SVN.

Step two: Install Maven on Linux. (Reference:http://simplelife.blog.51cto.com/9954761/1743977 )

The third step: under any directory in Linux, it is best to create a new directory yourself, such as the Ucenter directory

12345 mkdir /home/softs/ucentercd ucentersvn co   http://svnserver/mypro/trunk   ./    #从指定的svn地址中检出代码到当前目录 此时需要输入一些svn的用户名和密码,输入之后确定使用就是了。

Execution: SVN co http://svnserver/mypro/trunk/./

At this point the code in SVN has been checked out to the server ...

Execution under current directory: SVN up

Update the latest code in SVN and return to the SVN version

Go to the Ssm-parent directory and execute the command (Maven command): mvn-u clean Install

Enter SIMPLE-SSM to perform the same operation:

At this point there is one more directory in SIMPLE-SSM: Target, the war package for this project is in it.

Now that the Project war package has been generated, you can then copy the war to the Tomcat server and restart the server.

As mentioned above, these update codes, packaging, moving the war package to the server, and restarting the server can all be done with a simple shell script.

++++++++++++++++++++++++++++ write the shell script to be executed ++++++++++++++++++++++++++++++++

In the Ucenter directory (whichever directory, take this directory as an example)

New ssm-parent.sh File:

12 touch ssm-parent.shvim ssm-parent.sh

Write:

Exit after saving.

granting permissions to Files

1 chmod 755ssm-parent.sh

Perform:

1 ./ssm-parent.sh

New simple-ssm.sh File:

Touch simple-ssm.sh

Vim simple-ssm.sh

Write:

Exit after saving.

granting permissions to Files

1 chmod 755simple-ssm.sh

Perform:

1 ./simple-ssm.sh

This will release the SIMPLE-SSM project to completion.

Every time after the code is written, submitted to SVN, in the server can execute the two shell scripts (and of course, there are other projects shell script), you can easily publish the project, is not very convenient!

Perform:

12 ./ssm-parent.sh./simple-ssm.sh

It is possible to publish this project at all times.

Automating deployment projects with shell scripts under Linux

Related Article

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.