http://blog.csdn.net/xlgen157387/article/details/50353317
[quote]
#!/bin/bash
#copy file and restart tomcat
export JAVA_HOME=/data/home/server/jdk
export CATALINA_HOME=/home/xuliugen/dubbo-provider
export CATALINA_BASE=/home/xuliugen/dubbo-provider
export BUILD_ID=dontKillMe
tomcat_path=/home/xuliugen/dubbo-provider
project=dubbo-provider
war_name=dubbo-provider.war
war_path=http://132.153.131.237/:8022/jenkins/job/ManenDemo/ws/targetserver_port=8082
file_path=~/.jenkins/jobs/ManenDemo/workspace/spring_provider/target
$tomcat_path/bin/shutdown.sh
sleep 3s
echo "rm -rf ${tomcat_path}/webapps/ROOT/*"
rm -rf ${tomcat_path}/webapps/ROOT/*
cd $file_path
cp ${war_name} ${tomcat_path}/webapps/ROOT/
cd $tomcat_path/webapps/ROOT/
unzip ${war_name}
rm -rf ${war_name}
sleep 5s
#$tomcat_path/bin/startup.sh
cd $tomcat_path/bin/
./startup.sh
echo "server restarted"
[/quote]
[quote]
#!/bin/bash
#copy file and restart tomcat
export JAVA_HOME=/data/home/server/jdk
export CATALINA_HOME=/home/xuliugen/dubbo-provider
export CATALINA_BASE=/home/xuliugen/dubbo-provider
export BUILD_ID=dontKillMe
tomcat_path=/home/xuliugen/dubbo-provider
project=dubbo-provider
war_name=dubbo-provider.war
war_path=http://132.153.131.237/:8022/jenkins/job/ManenDemo/ws/targetserver_port=8082
file_path=~/.jenkins/jobs/ManenDemo/workspace/spring_provider/target
$tomcat_path/bin/shutdown.sh
sleep 3s
echo "rm -rf ${tomcat_path}/webapps/ROOT/*"
rm -rf ${tomcat_path}/webapps/ROOT/*
cd $file_path
cp ${war_name} ${tomcat_path}/webapps/ROOT/
cd $tomcat_path/webapps/ROOT/
unzip ${war_name}
rm -rf ${war_name}
sleep 5s
#$tomcat_path/bin/startup.sh
cd $tomcat_path/bin/
./startup.sh
echo "server restarted"
[/quote]