bin/hudson in hudson-0.2.0 vs bin/hudson in hudson-0.2.1
- old
+ new
@@ -3,21 +3,42 @@
require 'un'
require 'optparse'
options = {
- :port => 3001
+ :port => 3001,
+ :control => 3002
}
args = ARGV.dup
opts = OptionParser.new do |opts|
opts.banner = "Usage: hudson [options] DIR"
- opts.on("-p", "--port [3001]", "Run Hudson on specified port ") do |port|
+ opts.on("-d", "--daemon", "fork into background and run as daemon") do
+ options[:daemon] = true
+ end
+
+ opts.on("-p", "--port [3001]", "run hudson on specified port ") do |port|
options[:port] = port
end
+ opts.on("-c", "--control-port [3002]", Integer, "set the shutdown/control port") do |port|
+ options[:control] = cport
+ end
+
+ opts.on_tail("-k", "--kill", "send shutdown signal to control port") do
+ require 'socket'
+ TCPSocket.open("localhost", options[:control]) do |sock|
+ sock.write("0")
+ end
+ exit
+ end
+
+ opts.on_tail("-v", "--version", "show version information") do
+ puts "#{Hudson::VERSION} (Hudson Server #{Hudson::HUDSON_VERSION})"
+ exit
+ end
opts.on_tail("-h", "--help") do
puts opts
exit
end
@@ -29,7 +50,12 @@
exit(1)
end
FileUtils.mkdir_p dir
FileUtils.cp_r Hudson::PLUGINS, dir
ENV['HUDSON_HOME'] = dir
-exec("java", "-jar", Hudson::WAR, "--httpPort=#{options[:port]}")
+cmd = ["java", "-jar", Hudson::WAR]
+cmd << "--httpPort=#{options[:port]}"
+cmd << "--controlPort=#{options[:control]}"
+cmd << "--daemon" if options[:daemon]
+puts cmd.join(" ")
+exec(*cmd)