Jenkins installation and configuration

     The download, installation and deployment of jenkins is still simple, you can refer to the blog post http://blog.csdn.net/evankaka/article/details/50518959 . It is only a service deployed under tomcat, and the default port is 8080.

     The following is the script operation after building the war, basically the same, you can refer to the modification.

 

#/bin/sh
# tomcat webapp path
tomcatPath="/home/yiwu/apache-tomcat-7.0.52"
#auto deployPath
webWarfile="/home/yiwu/autodeploy/wars/reb-web-1.0.0.war"
workWarfile="/home/yiwu/autodeploy/wars/reb-work-1.0.0.war"
manageWarfile="/home/yiwu/autodeploy/wars/reb-manage-1.0.0.war"


#kill tomcat if run
PIDS=`ps -ef | grep java | grep "$tomcatPath" |awk '{print $2}'`
if [ -n "$PIDS" ]; then
    echo "PID: $PIDS,try to kill it"
    kill -9 $PIDS
be

#clear webapps dir
rm -rf "$tomcatPath"/webapps/ROOT
rm -rf "$tomcatPath"/manage/ROOT
rm -rf "$tomcatPath"/quds/ROOT
rm -rf "$tomcatPath"/logs/*

# if exist war
if [ ! -f "$webWarfile" ]; then
    echo "ERROR: The wars is not exist!"
    exit 1
else
    echo "move package to tomcat web webapps"
    mv "$webWarfile" "$tomcatPath"/webapps/ROOT.war
    echo "move done,wait work move job"
    #cd "$tomcatPath"/bin
    #sh startup.sh
be

if [ ! -f "$workWarfile" ]; then
    echo "ERROR: The wars is not exist!"
    exit 1
else
    echo "move package to tomcat work webapps"
    mv "$workWarfile" "$tomcatPath"/quds/ROOT.war
    echo "move done,wait manage move job"    
be

if [ ! -f "$manageWarfile" ]; then
    echo "ERROR: The wars is not exist!"
    exit 1
else
    echo "move package to tomcat manage webapps"
    mv "$manageWarfile" "$tomcatPath"/manage/ROOT.war
    echo "move done,try to start"
be

cd "$tomcatPath"/bin
sh startup.sh

TOMCATID=`ps -ef | grep java | grep "$tomcatPath" |awk '{print $2}'`
if [ -n "$TOMCATID" ]; then
    echo "TOMCATID:$TOMCATID start success"
be

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327049645&siteId=291194637