Linux Server batch deployment application system shell script (Tomcat/jetty)

Source: Internet
Author: User

Linux Server batch deployment application system shell script (Tomcat/jetty)

Shell script for batch deployment of application systems on linux servers:

1. Replace the server address in the Code (Tomcat or jetty server)

ServerRoot =/home/undoner/java_tool/apache-tomcat-7.0.61
ServerDir =/home/undoner/java_tool/apache-tomcat-7.0.61/webapps

2. Change the name of the configuration file to which the project belongs.

// WEB-INF/classes/install. properties

3. Upload the war package to the directory at the same level as this command and run the command. xxxxx is the project name.

./Install. sh xxxxx

 

#!/bin/bash#Please replace 'serverRoot' and 'serverDir' in your tomcat workspace#The batch installation script By undoner 2013.01.01 if [ ! -z $1 ];thenss=$1elsess=''fiserverDate=$(date +%Y%m%d)        serverRoot=/home/undoner/java_tool/apache-tomcat-7.0.61serverDir=/home/undoner/java_tool/apache-tomcat-7.0.61/webappsfor i in $ss;doserverBackup=$serverRoot"/backup/"$i"_"$serverDate        echo "install $i at $serverDate"        echo "serverRoot:$serverRoot"        echo "serverDir:$serverDir"        echo "serverBackup:$serverBackup"cp -r $serverDir/$i $serverBackupcp $serverDir/$i/WEB-INF/classes/install.properties ./install.propertiesrm -rf $serverDir/$i/*mv ./$i.war $serverDir/$i/cd $serverDir/$i/jar xf $i.warcd $OLDPWDmv ./install.properties $serverDir/$i/WEB-INF/classes/        echo "install/update $i success at $serverDate."done


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.