Module: Luban::Deployment::Applications::Rack::WebServers::Thin::Cluster
- Included in:
- Common
- Defined in:
- lib/luban/deployment/applications/rack/web_servers/thin.rb
Instance Method Summary collapse
- #monitor_command(service_entry) ⇒ Object
- #pid ⇒ Object
- #pid_file_exists? ⇒ Boolean
- #pid_file_pattern ⇒ Object
- #pid_files ⇒ Object
- #pid_files_path ⇒ Object
- #pids ⇒ Object
- #remove_orphaned_pid_file ⇒ Object
- #unmonitor_command(service_entry) ⇒ Object
Instance Method Details
#monitor_command(service_entry) ⇒ Object
37 38 39 |
# File 'lib/luban/deployment/applications/rack/web_servers/thin.rb', line 37 def monitor_command(service_entry) @monitor_command ||= "#{monitor_executable} monitor -g #{service_entry}" end |
#pid ⇒ Object
26 |
# File 'lib/luban/deployment/applications/rack/web_servers/thin.rb', line 26 def pid; pids; end |
#pid_file_exists? ⇒ Boolean
28 29 30 31 |
# File 'lib/luban/deployment/applications/rack/web_servers/thin.rb', line 28 def pid_file_exists? # Any pid file is NOT zero size pid_files.any? { |pid_file| file?(pid_file, "-s") } end |
#pid_file_pattern ⇒ Object
8 9 10 |
# File 'lib/luban/deployment/applications/rack/web_servers/thin.rb', line 8 def pid_file_pattern @pid_file_pattern ||= "#{current_web_server}.*.pid" end |
#pid_files ⇒ Object
16 17 18 19 20 |
# File 'lib/luban/deployment/applications/rack/web_servers/thin.rb', line 16 def pid_files capture(:ls, "-A #{pid_files_path} 2>/dev/null").split.map do |f| Pathname.new(f) end end |
#pid_files_path ⇒ Object
12 13 14 |
# File 'lib/luban/deployment/applications/rack/web_servers/thin.rb', line 12 def pid_files_path pids_path.join(pid_file_pattern) end |
#pids ⇒ Object
22 23 24 |
# File 'lib/luban/deployment/applications/rack/web_servers/thin.rb', line 22 def pids pid_files.collect { |pid_file| capture(:cat, "#{pid_file} 2>/dev/null") } end |
#remove_orphaned_pid_file ⇒ Object
33 34 35 |
# File 'lib/luban/deployment/applications/rack/web_servers/thin.rb', line 33 def remove_orphaned_pid_file rm(pid_files_path) if pid_file_orphaned? end |
#unmonitor_command(service_entry) ⇒ Object
41 42 43 |
# File 'lib/luban/deployment/applications/rack/web_servers/thin.rb', line 41 def unmonitor_command(service_entry) @unmonitor_command ||= "#{monitor_executable} unmonitor -g #{service_entry}" end |