Class: Pid

Inherits:
Object
  • Object
show all
Defined in:
lib/brisk/server/pid.rb

Class Method Summary collapse

Class Method Details

.alive?(pid) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
27
28
29
30
31
# File 'lib/brisk/server/pid.rb', line 24

def self.alive?(pid)
  begin
    Process.getpgid( pid.to_i )
    true
  rescue Errno::ESRCH
    false
  end
end

.exists?(path) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/brisk/server/pid.rb', line 20

def self.exists?(path)
  FileSystem.file_exists?("#{path}/tmp/pids/thin.pid")
end

.read(path) ⇒ Object



16
17
18
# File 'lib/brisk/server/pid.rb', line 16

def self.read(path)
  FileSystem.read("#{path}/tmp/pids/thin.pid")
end

.write(path, pid) ⇒ Object



5
6
7
8
9
# File 'lib/brisk/server/pid.rb', line 5

def self.write(path, pid)
  FileSystem.write("#{path}/pid.txt", pid)

  sleep(1)
end

.write_https(path, pid) ⇒ Object



11
12
13
14
# File 'lib/brisk/server/pid.rb', line 11

def self.write_https(path, pid)
  FileSystem.write("#{path}/https_pid.txt", pid)
  sleep(1)
end