Class: Thin::Commands::Cluster::Restart

Inherits:
Base show all
Defined in:
lib/thin/commands/cluster/restart.rb

Instance Attribute Summary

Attributes inherited from Base

#config, #trace

Attributes inherited from Thin::Command

#args

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

config_attributes

Methods inherited from Thin::Command

command_name, #initialize

Constructor Details

This class inherits a constructor from Thin::Command

Class Method Details

.detailed_helpObject



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/thin/commands/cluster/restart.rb', line 21

def self.detailed_help
  <<-EOF
usage: thin_cluster restart [options]

  Restart the servers one at the time.
  Prevent downtime by making sure only one is stopped at the time.
  
  For example, first server is stopped, then started. When the first
  server is fully started the second one is stopped ...
  
  See http://blog.carlmercier.com/2007/09/07/a-better-approach-to-restarting-a-mongrel-cluster/
EOF
end

.helpObject



17
18
19
# File 'lib/thin/commands/cluster/restart.rb', line 17

def self.help
  "Restart servers"
end

Instance Method Details

#runObject



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/thin/commands/cluster/restart.rb', line 3

def run
  load_from_config
  
  cluster = Thin::Cluster.new(cwd, address, port, servers)

  cluster.log_file = log_file
  cluster.pid_file = pid_file
  cluster.trace    = trace
  cluster.user     = user
  cluster.group    = group
  
  cluster.restart
end