### Home Classes Methods

### In Files

- lib/phusion_passenger/standalone/stop_command.rb

### Parent

PhusionPassenger::Standalone::Command

### Methods

- ::description
- #run

### Class/Module Index

Quicksearch

- PhusionPassenger
- PhusionPassenger::AbstractInstaller
- PhusionPassenger::AbstractInstaller::Abort
- PhusionPassenger::AbstractInstaller::CommandError
- PhusionPassenger::AdminTools
- PhusionPassenger::AdminTools::MemoryStats
- PhusionPassenger::AdminTools::MemoryStats::Process
- PhusionPassenger::AdminTools::ServerInstance
- PhusionPassenger::AdminTools::ServerInstance::CorruptedDirectoryError
- PhusionPassenger::AdminTools::ServerInstance::GenerationsAbsentError
- PhusionPassenger::AdminTools::ServerInstance::Group
- PhusionPassenger::AdminTools::ServerInstance::Process
- PhusionPassenger::AdminTools::ServerInstance::RoleDeniedError
- PhusionPassenger::AdminTools::ServerInstance::StaleDirectoryError
- PhusionPassenger::AdminTools::ServerInstance::Stats
- PhusionPassenger::AdminTools::ServerInstance::UnsupportedGenerationStructureVersionError
- PhusionPassenger::AnalyticsLogger
- PhusionPassenger::AnalyticsLogger::Connection
- PhusionPassenger::AnalyticsLogger::Lock
- PhusionPassenger::AnalyticsLogger::Log
- PhusionPassenger::ClassicRails
- PhusionPassenger::ClassicRails::CGIFixed
- PhusionPassenger::ClassicRails::ThreadHandlerExtension
- PhusionPassenger::ConsoleTextTemplate
- PhusionPassenger::DebugLogging
- PhusionPassenger::LoaderSharedHelpers
- PhusionPassenger::MessageChannel
- PhusionPassenger::MessageChannel::InvalidHashError
- PhusionPassenger::MessageClient
- PhusionPassenger::NativeSupportLoader
- PhusionPassenger::Packaging
- PhusionPassenger::PlatformInfo
- PhusionPassenger::PlatformInfo::Depcheck
- PhusionPassenger::PlatformInfo::Depcheck::ConsoleRunner
- PhusionPassenger::PlatformInfo::Depcheck::Dependency
- PhusionPassenger::PlatformInfo::RuntimeError
- PhusionPassenger::Plugin
- PhusionPassenger::PreloaderSharedHelpers
- PhusionPassenger::Rack
- PhusionPassenger::Rack::OutOfBandGc
- PhusionPassenger::Rack::ThreadHandlerExtension
- PhusionPassenger::Rails3Extensions
- PhusionPassenger::Rails3Extensions::AnalyticsLogging
- PhusionPassenger::Rails3Extensions::AnalyticsLogging::ACExtension
- PhusionPassenger::Rails3Extensions::AnalyticsLogging::ASBenchmarkableExtension
- PhusionPassenger::Rails3Extensions::AnalyticsLogging::ExceptionLogger
- PhusionPassenger::RequestHandler
- PhusionPassenger::RequestHandler::ThreadHandler
- PhusionPassenger::RequestHandler::ThreadHandler::Interrupted
- PhusionPassenger::SharedConstants
- PhusionPassenger::Standalone
- PhusionPassenger::Standalone::AppFinder
- PhusionPassenger::Standalone::Command
- PhusionPassenger::Standalone::ConfigFile
- PhusionPassenger::Standalone::ConfigFile::DisallowedContextError
- PhusionPassenger::Standalone::HelpCommand
- PhusionPassenger::Standalone::Main
- PhusionPassenger::Standalone::PackageRuntimeCommand
- PhusionPassenger::Standalone::RuntimeInstaller
- PhusionPassenger::Standalone::StartCommand
- PhusionPassenger::Standalone::StatusCommand
- PhusionPassenger::Standalone::StopCommand
- PhusionPassenger::Standalone::Utils
- PhusionPassenger::Standalone::VersionCommand
- PhusionPassenger::Utils
- PhusionPassenger::Utils::AnsiColors
- PhusionPassenger::Utils::FileSystemWatcher
- PhusionPassenger::Utils::FileSystemWatcher::DirInfo
- PhusionPassenger::Utils::FileSystemWatcher::FileInfo
- PhusionPassenger::Utils::HostsFileParser
- PhusionPassenger::Utils::TeeInput
- PhusionPassenger::Utils::TmpIO
- PhusionPassenger::Utils::UnseekableSocket
- CommonLibraryBuilder
- Exception
- GC
- IO
- Object
- Signal

No matching classes.

# PhusionPassenger::Standalone::StopCommand

### Public Class Methods

description() click to toggle source

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

### Public Instance Methods

run() click to toggle source

    # File lib/phusion_passenger/standalone/stop_command.rb, line 33
    def run
            parse_options!("stop") 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?
            rescue SystemCallError, IOError
                    running = false
            end
            if running
                    @nginx.stop
            else
                    STDERR.puts "According to the PID file '#{@options[:pid_file]}', " <<
                            "Phusion Passenger Standalone doesn't seem to be running."
                    STDERR.puts
                    STDERR.puts "If you know that Phusion Passenger Standalone *is* running then one of these"
                    STDERR.puts "might be the cause of this error:"
                    STDERR.puts
                    STDERR.puts " * The Phusion Passenger Standalone instance that you want to stop isn't running"
                    STDERR.puts "   on port #{@options[:port]}, but on another port. If this is the case then you"
                    STDERR.puts "   should specify the right port with --port."
                    STDERR.puts "   If the instance is listening on a Unix socket file instead of a TCP port,"
                    STDERR.puts "   then please specify the PID file's filename with --pid-file."
                    STDERR.puts " * The instance that you want to stop has stored its PID file in a non-standard"
                    STDERR.puts "   location. In this case please specify the right PID file with --pid-file."
                    exit 1
            end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.