Class: Sbire::PidManager

Inherits:
Object
  • Object
show all
Defined in:
lib/sbire/pid_manager.rb

Instance Method Summary collapse

Instance Method Details

#kill(object) ⇒ Object



7
8
9
10
11
12
# File 'lib/sbire/pid_manager.rb', line 7

def kill(object)
  if File.exists?("/tmp/#{class_name(object)}.pid")
    pid = File.read("/tmp/#{class_name(object)}.pid")
    system("kill #{pid}")
  end
end

#store(object, pid) ⇒ Object



3
4
5
# File 'lib/sbire/pid_manager.rb', line 3

def store(object, pid)
  File.open("/tmp/#{class_name(object)}.pid", 'w') {|file| file.write(pid)}
end