mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Added stupport for status
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@518 19e92222-5c0b-0410-8929-a290d50e31e9
This commit is contained in:
parent
173ad80369
commit
8872b36a0f
2 changed files with 19 additions and 6 deletions
|
@ -8,11 +8,11 @@ def run(command, verbose)
|
|||
confs = Dir.glob("*.yml")
|
||||
confs += Dir.glob("*.conf")
|
||||
confs.each do |conf|
|
||||
cmd = "mongrel_rails cluster::#{command} -c #{conf}"
|
||||
cmd = "mongrel_rails cluster::#{command} -C #{conf}"
|
||||
cmd += " -v" if verbose
|
||||
puts cmd if verbose
|
||||
puts cmd if verbose || command == "status"
|
||||
output = `#{cmd}`
|
||||
puts output if verbose
|
||||
puts output if verbose || command == "status"
|
||||
puts "mongrel_rails cluster::#{command} returned an error." unless $?.success?
|
||||
end
|
||||
end
|
||||
|
@ -23,7 +23,7 @@ end
|
|||
@options[:verbose] = false
|
||||
|
||||
OptionParser.new do |opts|
|
||||
opts.banner = "Usage: #{$0} (start|stop|restart) [options]"
|
||||
opts.banner = "Usage: #{$0} (start|stop|restart|status) [options]"
|
||||
|
||||
opts.on("-c", "--conf_path PATH", "Path to mongrel_cluster configuration files") { |value| @options[:conf_path] = value }
|
||||
opts.on('-v', '--verbose', "Print all called commands and output.") { |value| @options[:verbose] = value }
|
||||
|
@ -57,8 +57,11 @@ when "restart":
|
|||
puts "Restarting all mongrel_clusters..."
|
||||
run "stop", @options[:verbose]
|
||||
run "start", @options[:verbose]
|
||||
when "status":
|
||||
puts "Checking all mongrel_clusters..."
|
||||
run "status", @options[:verbose]
|
||||
else
|
||||
puts "Unknown command."
|
||||
end
|
||||
|
||||
exit
|
||||
exit
|
||||
|
|
|
@ -58,6 +58,16 @@ Capistrano.configuration(:must_exist).load do
|
|||
set_mongrel_conf
|
||||
send(run_method, "mongrel_rails cluster::stop -C #{mongrel_conf}")
|
||||
end
|
||||
|
||||
desc <<-DESC
|
||||
Check the status of the Mongrel processes on the app server. This uses the :use_sudo
|
||||
variable to determine whether to use sudo or not. By default, :use_sudo is
|
||||
set to true.
|
||||
DESC
|
||||
task :status_mongrel_cluster , :roles => :app do
|
||||
set_mongrel_conf
|
||||
send(run_method, "mongrel_rails cluster::status -C #{mongrel_conf}")
|
||||
end
|
||||
|
||||
desc <<-DESC
|
||||
Restart the Mongrel processes on the app server by calling restart_mongrel_cluster.
|
||||
|
@ -77,4 +87,4 @@ Capistrano.configuration(:must_exist).load do
|
|||
set :mongrel_conf, "/etc/mongrel_cluster/#{application}.yml" unless mongrel_conf
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue