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