OS/Linux

Jenkins Script cmd

아르비스 2016. 7. 7. 18:50

실행을 위한 Script


# vi Start_jenkins.sh

#!/bin/sh


# check user


USER=`whoami`

if [ ${USER} != "jenkins" ]; then

        echo ''

        echo 'please!!!'

        echo 'login jenkins.'

        echo ''

        exit

fi



nohup /usr/java/jdk1.8.0_60/jre/bin/java -Xrs -Xmx1024m -DJENKINS_HOME=/home/jenkins/jenkins/configs -jar /home/jenkins/jenkins/jenkins.war --httpPort=8081 &




# vi Stop_jenkins.sh

#!/bin/sh


if [ -z "`ps -eaf | grep jenkins | grep java`" ]; then

  echo "Jenkins was not started."

else

  ps -eaf | grep jenkins | grep java | awk '{print $2}' |

  while read PID

  do

    echo "Killing $PID ..."

    kill -9 $PID

    echo

    echo "Jenkins is being shutdowned."

  done

fi