Linux a key deployment script

Input in the current path
chmod 777 the script name
Authorization to the script,
Then you can execute the script
./ script name 
 
777 is the highest authority, to read, write and execute permissions; and a group of users and other users to read, write, and execute permissions.
Other rights are
-rw ------- (600) - only read and write permissions.
-rw-r - r-- (644) - have only read and write access; and a group of users and other users only read access.
-rwx ------ (700) - only to read, write, and execute permissions.
-rwxr-xr-x (755) - to read, write, and execute permissions; and a group of users and other users only read and execute permissions.
-rwx - x - x (711) - to read, write, and execute permissions; and the other is a group of users and users only execute permissions.
 
read -p "Press any key to continue." var - script to pause, need to press any key to continue ......

Own deployment script 1

cd / mnt / jfinalgit / Web
 echo  " ############## enter / mnt / jfinalgit / web directory ############## " 
RM -rf *
 RM -rf. * 
git clone git ********** .git
 echo  " ############## git pull is completed, start packing ####### ####### " 
cd / mnt / jfinalgit / Web / jfinalweb
mvn package
echo  " ############## Maven package is complete, close copy tomcat war package ############## " 
killall the Java
 SLEEP 3S
cd / mnt / apache-tomcat- 9.0 . 0 .M4 / webapps / jf
 cp / mnt / jfinalgit / web / jfinalweb / target / jfinalweb-V0. 1 .war.
jar -xvf jfinalweb-V0.1.war
cd / mnt /
 echo  " ############# started to enter the mnt directory tomcat, and view the log ########### " 
. / tomcatstart
tailf catalina.out &

 

Script 2

buildpkg=/mnt/tbkmark-tomcat-9.0.0.M4/gitsourcepkg/
buildpkgName=tbkmark-0.0.1-SNAPSHOT.war
targetpath=/mnt/tbkmark-tomcat-9.0.0.M4/gitsourcepkg/tbk_market/target/tbkmark-0.0.1-SNAPSHOT.war
projectName=/mnt/tbkmark-tomcat-9.0.0.M4/gitsourcepkg/tbk_market
tomcatName=tbkmark
projectPath=/mnt/tbkmark-tomcat-9.0.0.M4/webapps/ROOT
startpath=/mnt/tbkmark-tomcat-9.0.0.M4/bin/startup.sh
logpath=/mnt/tbkmark-tomcat-9.0.0.M4/logs/catalina.out
echo "##### start build tbkmark #####"
cd $buildpkg
rm -rf *
git clone https://git.oschina.net/mrning001/tbk_market.git
echo "##### git pull ok #####"
cd $projectName
mvn package -Dmaven.test.skip=true
echo "##### maven pkg ok #####"
ps -ef | grep tomcat | grep $tomcatName | awk '{print $2}'|xargs kill -9
cd $projectPath
rm -rf *
cp $targetpath $projectPath
jar -xvf $buildpkgName
echo "##### kill tomcat and  cp pkg to root ok !!! #####"
\cp /application.properties /mnt/tbkmark-tomcat-9.0.0.M4/webapps/ROOT/WEB-INF/classes
sh $startpath
sleep 5s
tailf -n 500 $logpath

[Ps -ef Find out in accordance with the specified process and kill, and then restart the tomcat process]

ps -ef|grep xxxxName|grep tomcat|awk '{print $2}'|xargs kill -9
sh /mnt/data1/esports/tomcat-8.0.35/bin/startup.sh

 

[SVN package deployment script]

 
projectName=projectName
targetMathineme=duoyou
targetTomcatWebAppsDir="~/tomcat-8.0.35/webapps"
svnPath=http://xxxx.xxx.xxx
checkoutDir="checkout"
targetWarName=projectName
mvn scm:bootstrap -DconnectionUrl=scm:svn:$svnPath -DcheckoutDirectory=$checkoutDir -Dgoals=package -Dprofiles=skipTest,dev -DmavenHome=""
if [ -f "./$checkoutDir/target/$targetWarName.war" ]; then
echo "File projectName Generate success!"
scp $checkoutDir/target/$targetWarName.war $targetMathine:$targetTomcatWebAppsDir/$targetWarName.war.tmp
ssh $targetMathine "mv $targetTomcatWebAppsDir/$targetWarName.war.tmp $targetTomcatWebAppsDir/$targetWarName.war"
be
echo "projectName.war publish success. "

Guess you like

Origin www.cnblogs.com/ning-blogs/p/12070366.html