Class PhusionPassenger::AdminTools::ControlProcess |
In: | lib/phusion_passenger/admin_tools/control_process.rb
Parent: | Object

Methods

- domains
- instances
- list
- new
- status
- xml

Classes and Modules
Class PhusionPassenger::AdminTools::ControlProcess::Instance
Attributes

[RW] | path |
[RW] | pid |

Public Class methods
list(clean_stale = true)

[ show source ]

        # File lib/phusion_passenger/admin_tools/control_process.rb, line 18
    18:         def self.list(clean_stale = true)
    19:                 results = []
    20:                 Dir["#{AdminTools.tmpdir}/passenger.*"].each do |dir|
    21:                         dir =~ /passenger.(\d+)\Z/
    22:                         next if !$1
    23:                         pid = $1.to_i
    24:                         begin
    25:                                 results << ControlProcess.new(pid, dir)
    26:                         rescue ArgumentError
    27:                                 # Stale Passenger temp folder. Clean it up if instructed.
    28:                                 if clean_stale
    29:                                         puts "*** Cleaning stale folder #{dir}"
    30:                                         FileUtils.chmod_R(0700, dir) if File.exist?(dir)
    31:                                         FileUtils.rm_rf(dir)
    32:                                 end
    33:                         end
    34:                 end
    35:                 return results
    36:         end

new(pid, path = nil)

[ show source ]

        # File lib/phusion_passenger/admin_tools/control_process.rb, line 38
    38:         def initialize(pid, path = nil)
    39:                 if !AdminTools.process_is_alive?(pid)
    40:                         raise ArgumentError, "There is no control process with PID #{pid}."
    41:                 end
    42:                 @pid = pid
    43:                 if path
    44:                         @path = path
    45:                 else
    46:                         @path = "#{AdminTools.tmpdir}/passenger.#{pid}"
    47:                 end
    48:         end

Public Instance methods
domains()

[ show source ]

        # File lib/phusion_passenger/admin_tools/control_process.rb, line 60
    60:         def domains
    61:                 reload
    62:                 return @domains
    63:         end

instances()

[ show source ]

        # File lib/phusion_passenger/admin_tools/control_process.rb, line 65
    65:         def instances
    66:                 return domains.map do |domain|
    67:                         domain[:instances]
    68:                 end.flatten
    69:         end

status()

[ show source ]

        # File lib/phusion_passenger/admin_tools/control_process.rb, line 50
    50:         def status
    51:                 reload
    52:                 return @status
    53:         end

xml()

[ show source ]

        # File lib/phusion_passenger/admin_tools/control_process.rb, line 55
    55:         def xml
    56:                 reload
    57:                 return @xml
    58:         end