Created
May 9, 2012 06:45
-
-
Save kyonmm/2642508 to your computer and use it in GitHub Desktop.
Jenkins起動スクリプト
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Jenkins起動スクリプトです。 | |
//環境変数にJENKINS_HOMEを指定する必要があります。 | |
//また、jenkins.warはJENKINS_HOME配下にあるものとして使われています。 | |
if(!System.getenv("JENKINS_HOME")){ | |
println "Please Set 'JENKINS_HOME'" | |
return | |
} | |
if(!new File("${System.getenv("JENKINS_HOME")}/jenkins.war").exists()){ | |
println "Please Confilm ${System.getenv("JENKINS_HOME")}/jenkins.war" | |
return | |
} | |
def jenkins = {String command, process = null -> | |
switch (command){ | |
case "start" : | |
def c = "java -jar ${System.getenv("JENKINS_HOME")}/jenkins.war > jenkins_app.log\n" | |
println c | |
process = c.execute() | |
println "Jenkins Started. Try Access: http://serverhost:8080/\n" | |
return process | |
case "stop" : | |
if(process){ | |
process.destroy() | |
println "Jenkins Stopped.\n" | |
} | |
return null | |
default : | |
println "Input start/stop\n" | |
} | |
} | |
def process = null | |
while(true){ | |
println "Input start/stop\n" | |
scanner = new Scanner(System.in) | |
process = jenkins(scanner.next(), process) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment