Class: PhusionPassenger::Standalone::StatusCommand

Inherits:
Command show all
Defined in:
lib/phusion_passenger/standalone/status_command.rb

Constant Summary

Constants inherited from Command

Command::DEFAULT_OPTIONS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

#initialize, show_in_command_list

Constructor Details

This class inherits a constructor from PhusionPassenger::Standalone::Command

Class Method Details

.descriptionObject



29
30
31
# File 'lib/phusion_passenger/standalone/status_command.rb', line 29

def self.description
  return "Show the status of a running Passenger Standalone instance."
end

Instance Method Details

#runObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/phusion_passenger/standalone/status_command.rb', line 33

def run
  parse_options!("status") do |opts|
    opts.on("-p", "--port NUMBER", Integer,
      wrap_desc("The port number of a Phusion Passenger Standalone instance (default: #{@options[:port]})")) do |value|
      @options[:port] = value
    end
    opts.on("--pid-file FILE", String,
      wrap_desc("PID file of a running Phusion Passenger Standalone instance.")) do |value|
      @options[:pid_file] = value
    end
  end
  
  determine_various_resource_locations(false)
  create_nginx_controller
  begin
    running = @nginx.running?
    pid = @nginx.pid
  rescue SystemCallError, IOError
    running = false
  end
  if running
    puts "Phusion Passenger Standalone is running on PID #{pid}, according to PID file #{@options[:pid_file]}"
  else
    puts "Phusion Passenger Standalone is not running, according to PID file #{@options[:pid_file]}"
  end
end