본문 바로가기
Linux/Jenkins

jenkins 시작 script

by 준섭이 2023. 12. 23.
728x90

### jenkins .war 파일로 실행 시, script

#!/bin/bash
echo "Project PID Check..."

APP_ROOT=/home/jenkins/apps
PID_FILE=jenkins.pid
JAR_FILE=jenkins.war

PID_PATH=${APP_ROOT}/${PID_FILE}
JAR_PATH=${APP_ROOT}/${JAR_FILE}

CURRENT_PID=`cat ${PID_PATH}`

echo "Running PID - {$CURRENT_PID}"

if [ -z "$CURRENT_PID" ]
then
        echo "Project is not running"
else
        if ps -p ${CURRENT_PID} > /dev/null 2>&1 ; then
                kill -15 $CURRENT_PID
                sleep 10
        fi
fi

echo "Starting Jenkins....."
BUILD_ID=dontKillMe nohup java -Djava.awt.headless=true -jar ${JAR_PATH} --httpPort=8080 >/dev/null 2>&1 & echo $! > ${PID_PATH}

 

 

 

'Linux > Jenkins' 카테고리의 다른 글

jenkins 권한 설정  (0) 2023.12.23
jenkins ssh remote host Plugin 설치  (0) 2023.12.23
리눅스 Jenkins 설치  (0) 2023.12.23