Class PhusionPassenger::Standalone::StopCommand |
In: | lib/phusion_passenger/standalone/stop_command.rb
Parent: | Command

Methods

- description
- run

Public Class methods
description()

[ show source ]

        # File lib/phusion_passenger/standalone/stop_command.rb, line 29
    29:         def self.description
    30:                 return "Stop a running Phusion Passenger Standalone instance."
    31:         end

Public Instance methods
run()

[ show source ]

        # File lib/phusion_passenger/standalone/stop_command.rb, line 33
    33:         def run
    34:                 parse_options!("stop") do |opts|
    35:                         opts.on("-p", "--port NUMBER", Integer,
    36:                                 wrap_desc("The port number of a Phusion Passenger Standalone instance (default: #{@options[:port]})")) do |value|
    37:                                 @options[:port] = value
    38:                         end
    39:                         opts.on("--pid-file FILE", String,
    40:                                 wrap_desc("PID file of a running Phusion Passenger Standalone instance.")) do |value|
    41:                                 @options[:pid_file] = value
    42:                         end
    43:                 end
    44:
    45:                 determine_various_resource_locations(false)
    46:                 create_nginx_controller
    47:                 begin
    48:                         running = @nginx.running?
    49:                 rescue SystemCallError, IOError
    50:                         running = false
    51:                 end
    52:                 if running
    53:                         @nginx.stop
    54:                 else
    55:                         STDERR.puts "According to the PID file '#{@options[:pid_file]}', " <<
    56:                                 "Phusion Passenger Standalone doesn't seem to be running."
    57:                         STDERR.puts
    58:                         STDERR.puts "If you know that Phusion Passenger Standalone *is* running then one of these"
    59:                         STDERR.puts "might be the cause of this error:"
    60:                         STDERR.puts
    61:                         STDERR.puts " * The Phusion Passenger Standalone instance that you want to stop isn't running on"
    62:                         STDERR.puts "   port #{@options[:port]}, but on another port. If this is the case then you should"
    63:                         STDERR.puts "   specify the right port with --port."
    64:                         STDERR.puts "   If the instance is listening on a Unix socket file instead of a TCP port,"
    65:                         STDERR.puts "   then please specify the PID file's filename with --pid-file."
    66:                         STDERR.puts " * The instance that you want to stop has stored its PID file in a non-standard"
    67:                         STDERR.puts "   location. In this case please specify the right PID file with --pid-file."
    68:                         exit 1
    69:                 end
    70:         end