Class: Thin::Controllers::Service

Class Thin::Controllers::Service < Controller

(in files lib/thin/controllers/service.rb )

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

Includes

Methods

Public Class new(options)

    # File lib/thin/controllers/service.rb, line 12
12:       def initialize(options)
13:         super
14:       
15:         raise PlatformNotSupported, 'Running as a service only supported on Linux' unless Thin.linux?
16:       end

Public Instance config_path()

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

Public Instance install(config_files_path=DEFAULT_CONFIG_PATH)

    # File lib/thin/controllers/service.rb, line 34
34:       def install(config_files_path=DEFAULT_CONFIG_PATH)
35:         if File.exist?(INITD_PATH)
36:           log ">> Thin service already installed at #{INITD_PATH}"
37:         else
38:           log ">> Installing thin service at #{INITD_PATH} ..."
39:           sh "mkdir -p #{File.dirname(INITD_PATH)}"
40:           log "writing #{INITD_PATH}"        
41:           File.open(INITD_PATH, 'w') do |f|
42:             f << ERB.new(File.read(TEMPLATE)).result(binding)
43:           end
44:           sh "chmod +x #{INITD_PATH}" # Make executable
45:         end
46:       
47:         sh "mkdir -p #{config_files_path}"
48: 
49:         log ''
50:         log "To configure thin to start at system boot:"
51:         log "on RedHat like systems:"
52:         log "  sudo /sbin/chkconfig --level 345 #{NAME} on"
53:         log "on Debian-like systems (Ubuntu):"
54:         log "  sudo /usr/sbin/update-rc.d -f #{NAME} defaults"
55:         log "on Gentoo:"
56:         log "  sudo rc-update add #{NAME} default"
57:         log ''
58:         log "Then put your config files in #{config_files_path}"
59:       end

Public Instance restart()

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

Public Instance start()

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

Public Instance stop()

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