Jenkins Build tomcat restart 방법에 대한 포스팅입니다.
Jenkins -> sample project -> 구성 -> Build -> Execute shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
echo "------------------ sample deploy & sample tomcat restart ---------------------" cp /server/jenkins_home/workspace/sample/target/sample-0.0.1-SNAPSHOT-*.war /server/instance/sample/webapps/ROOT.war sleep 5 if [ ! -z "`ps -eaf | grep -v "grep" | grep java | grep /server/instance/sample/bin`" ]; then echo 'Tomcat was stop' /server/instance/sample/bin/stop.sh fi if [ -f /server/instance/sample/bin/tomcat.pid ]; then rm /server/instance/sample/bin/tomcat.pid echo "tomcat PID File Delete" fi echo "tomcat restart now" if [ -z "`ps -eaf | grep -v "grep" | grep java | grep /server/instance/sample/bin`" ]; then BUILD_ID=dontKillMe /server/instance/sample/bin/start.sh echo 'Tomcat restart succcessfully.' fi echo "Job finished" echo "------------------ javadoc deploy & javadoc tomcat restart ---------------------" cp /server/jenkins_home/workspace/sample/target/sample-0.0.1-SNAPSHOT-*.jar /server/instance/javadoc/webapps/sample.war sleep 5 if [ ! -z "`ps -eaf | grep -v "grep" | grep java | grep /server/instance/javadoc/bin`" ]; then echo 'javadoc Tomcat was stop' /server/instance/javadoc/bin/stop.sh fi if [ -f /server/instance/javadoc/bin/tomcat.pid ]; then rm /server/instance/javadoc/bin/tomcat.pid echo "javadoc tomcat PID File Delete" fi echo "javadoc tomcat restart now" if [ -z "`ps -eaf | grep -v "grep" | grep java | grep /server/instance/javadoc/bin`" ]; then BUILD_ID=dontKillMe /server/instance/javadoc/bin/start.sh echo 'javadoc Tomcat restart succcessfully.' fi echo "Job finished" |