Shell uses shell scripts to publish the project

Source: Internet
Author: User
Tags posix svn

The first time to write shell scripts, no experience, is to write directly, or to go through the process ( ̄▽ ̄) ~*

-----------------------------------------------------------------------

In general, three steps, let's do it with me.

-----------------------------------------------------------------------

First step: Create a file first

public. Sh

Step two: Write the script

#!/bin/Bashecho $1#进入SVN临时目录cd/tmp/svn/repo/ideapwd# Delete SVN project RM-RF $1#更新SVN项目svn Co svn:localhost/repo/idea/$1#复制war包到项目cp-RF ${1}/target/${1}.war/usr/local/data/$1/tomcat/webapps# into Tomcatcd/usr/local/data/$1/tomcat# stop Tomcat./bin/shutdown.sh# Delete root file rm-RF webapps/root/*#解压项目war包unzip-O webapps/$1. war-d webapps/ROOT#启动tomcat./bin/startup.sh# displaying tomcat boot information tail-F Logs/catalina.out

Knowledge Points:

1.#!/bin/bash: This sentence is used to define which SH interpreter to use to interpret the script, there are two, there is a time #!/bin/sh. So what's the difference between these two types of parties?

[Email protected] bin]# ll/bin/14: Bash/bin/sh- A

Through the above can see SH generally set to bash soft chain, in the general Linux system (such as Redhat), using the SH call execution script is equivalent to open bash POSIX standard mode, that is to say/bin/sh equivalent to/bin/bash--posix.

2.echo $1:echo is used to print in streets, which represents the first parameter passed in

Step three: Execute the shell script

SH publish.sh Hospital

Extracurricular topics:

1. If you want to use the same as the boot tomcal./startup.sh boot then you need to execute the command before executing the script.

chmod +x publish.sh

2. Remember the first line of #!/bin/bash on the top of Daming Lake? If you execute the following command, you can stop it.

Bash public.sh

Shell uses shell scripts to publish the project

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.