1、jenkins下载地址:http://pan.baidu.com/s/1eSHusCi
2、创建shell脚本,如:jenkins.sh
#!/bin/bash pid=`ps -ef | grep jenkins.war | grep -v 'grep'| awk '{print $2}'| wc -l` if [ "$1" = "start" ];then if [ $pid -gt 0 ];then echo 'jenkins is running...' else java -jar /opt/grow/jenkins.war --httpPort=8060 >/dev/null 2>&1 & fi elif [ "$1" = "stop" ];then exec ps -ef | grep jenkins | grep -v grep | awk '{print $2}'| xargs kill -9 echo 'jenkins is stop..' else echo "Please input like this:"./jenkins.sh start" or "./jenkins stop"" fi
3、启动和停止命令
启动命令:./jenkins.sh start
停止命令:./jenkins.sh stop