Class: Thin::Controllers::Service

### Home Classes Methods

### In Files

- lib/thin/controllers/service.rb

### Parent

Thin::Controllers::Controller

### Methods

- ::new
- #config_path
- #install
- #restart
- #start
- #stop

### Class/Module Index

Quicksearch

- Thin
- Thin::Backends
- Thin::Backends::Base
- Thin::Backends::SwiftiplyClient
- Thin::Backends::TcpServer
- Thin::Backends::UnixServer
- Thin::Command
- Thin::Connection
- Thin::Controllers
- Thin::Controllers::Cluster
- Thin::Controllers::Controller
- Thin::Controllers::Service
- Thin::Daemonizable
- Thin::Daemonizable::ClassMethods
- Thin::Headers
- Thin::InvalidOption
- Thin::InvalidRequest
- Thin::Logging
- Thin::Logging::SimpleFormatter
- Thin::OptionRequired
- Thin::PidFileExist
- Thin::PidFileNotFound
- Thin::PlatformNotSupported
- Thin::Request
- Thin::Response
- Thin::RestartTimeout
- Thin::Runner
- Thin::RunnerError
- Thin::Server
- Thin::Stats
- Thin::Stats::Adapter
- Thin::SwiftiplyConnection
- Thin::UnixConnection
- Rack
- Rack::Adapter
- Rack::Adapter::Rails
- Rack::Adapter::Rails::CGIWrapper
- Rack::Adapter::Rails::CgiApp
- Rack::AdapterNotFound
- Process

No matching classes.

# Thin::Controllers::Service

System service controller to launch all servers which config files are in a directory.

### Constants

DEFAULT_CONFIG_PATH
INITD_PATH
TEMPLATE

### Public Class Methods

new(options) click to toggle source

    # File lib/thin/controllers/service.rb, line 12
    def initialize(options)
      super

      raise PlatformNotSupported, 'Running as a service only supported on Linux' unless Thin.linux?
    end

### Public Instance Methods

config_path() click to toggle source

    # File lib/thin/controllers/service.rb, line 18
    def config_path
      @options[:all] || DEFAULT_CONFIG_PATH
    end

install(config_files_path=DEFAULT_CONFIG_PATH) click to toggle source

    # File lib/thin/controllers/service.rb, line 34
    def install(config_files_path=DEFAULT_CONFIG_PATH)
      if File.exist?(INITD_PATH)
        log_info "Thin service already installed at #{INITD_PATH}"
      else
        log_info "Installing thin service at #{INITD_PATH} ..."
        sh "mkdir -p #{File.dirname(INITD_PATH)}"
        log_info "writing #{INITD_PATH}"
        File.open(INITD_PATH, 'w') do |f|
          f << ERB.new(File.read(TEMPLATE)).result(binding)
        end
        sh "chmod +x #{INITD_PATH}" # Make executable
      end

      sh "mkdir -p #{config_files_path}"

      log_info ''
      log_info "To configure thin to start at system boot:"
      log_info "on RedHat like systems:"
      log_info "  sudo /sbin/chkconfig --level 345 #{NAME} on"
      log_info "on Debian-like systems (Ubuntu):"
      log_info "  sudo /usr/sbin/update-rc.d -f #{NAME} defaults"
      log_info "on Gentoo:"
      log_info "  sudo rc-update add #{NAME} default"
      log_info ''
      log_info "Then put your config files in #{config_files_path}"
    end

restart() click to toggle source

    # File lib/thin/controllers/service.rb, line 30
    def restart
      run :restart
    end

start() click to toggle source

    # File lib/thin/controllers/service.rb, line 22
    def start
      run :start
    end

stop() click to toggle source

    # File lib/thin/controllers/service.rb, line 26
    def stop
      run :stop
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.