Class: Thin::Commands::Server::Stop

Inherits:
Base show all
Defined in:
lib/thin/commands/server/stop.rb

Instance Attribute Summary collapse

Attributes inherited from Thin::Command

#args

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Thin::Command

command_name, #initialize

Constructor Details

This class inherits a constructor from Thin::Command

Instance Attribute Details

#pid_fileObject

Returns the value of attribute pid_file.



3
4
5
# File 'lib/thin/commands/server/stop.rb', line 3

def pid_file
  @pid_file
end

#timeoutObject

Returns the value of attribute timeout.



3
4
5
# File 'lib/thin/commands/server/stop.rb', line 3

def timeout
  @timeout
end

Class Method Details

.detailed_helpObject



19
20
21
22
23
24
25
26
27
# File 'lib/thin/commands/server/stop.rb', line 19

def self.detailed_help
  <<-EOF
usage: thin stop [PATH] [options]

  Stops the web server running in the background
  which PID is in the file PATH/<pid-file>
  (default to <current directory>/tmp/pids/thin.pid).
EOF
end

.helpObject



15
16
17
# File 'lib/thin/commands/server/stop.rb', line 15

def self.help
  "Stops the web server running in the background."
end

Instance Method Details

#cwdObject



5
6
7
# File 'lib/thin/commands/server/stop.rb', line 5

def cwd
  args.first || '.'
end

#runObject



9
10
11
12
13
# File 'lib/thin/commands/server/stop.rb', line 9

def run
  error 'PID file required' unless pid_file
  Dir.chdir cwd
  Thin::Server.kill(pid_file, timeout.to_i)
end