jenkins中使用 command shell
http://blog.csdn.net/xlgen157387/article/details/50353317
#!/bin/bash
#copyfileandrestarttomcat
exportJAVA_HOME=/data/home/server/jdk
exportCATALINA_HOME=/home/xuliugen/dubbo-provider
exportCATALINA_BASE=/home/xuliugen/dubbo-provider
exportBUILD_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
sleep3s
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}
sleep5s
#$tomcat_path/bin/startup.sh
cd$tomcat_path/bin/
./startup.sh
echo"serverrestarted"