Class: Codesake::Commons::Io

Inherits:
Object
  • Object
show all
Defined in:
lib/codesake/commons/io.rb

Class Method Summary collapse

Class Method Details

.create_pid_file(pid_file) ⇒ Object



8
9
10
11
12
# File 'lib/codesake/commons/io.rb', line 8

def self.create_pid_file(pid_file)
  f = File.new(pid_file, "w") 
  f.write("#{Process.pid}")
  f.close
end

.read_pid_file(pid_file) ⇒ Object



14
15
16
17
18
19
# File 'lib/codesake/commons/io.rb', line 14

def self.read_pid_file(pid_file)
  f = File.new(pid_file, "r")
  pid=f.read
  f.close
  pid
end

.remove_pid_file(pid_file) ⇒ Object



4
5
6
# File 'lib/codesake/commons/io.rb', line 4

def self.remove_pid_file(pid_file)
  File.delete(pid_file) if File.exists?(pid_file)
end