Linux Server Batch Deployment application shell script:
1. Please replace the server address (Tomcat or jetty server) within the code
serverroot=/home/undoner/java_tool/apache-tomcat-7.0.61
Serverdir=/home/undoner/java_tool/apache-tomcat-7.0.61/webapps
2. Please change the name of the profile to which the project belongs
/web-inf/classes/install.properties
3. Upload the war packet to the directory at the same level as this command, execute it, xxxxx 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 $];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;d oserverbackup=$ 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
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Linux Server Batch Deployment Application shell script (Tomcat/jetty)