Sha256: 0e09c272f653fe2da5bfb70ef1a4578bf82315125933c49f428219cc42590dc0
Contents?: true
Size: 387 Bytes
Versions: 19
Compression:
Stored size: 387 Bytes
Contents
class SimpleDaemonize def self.start(proc, pid_path) pid = fork { STDOUT.reopen "/dev/null" proc.call } File.open(pid_path, 'w') { |file| file.write(pid) } pid end def self.stop(pid_path) return unless File.exists?(pid_path) system "kill #{File.read(pid_path)} &> /dev/null" system "rm #{pid_path} &> /dev/null" end end
Version data entries
19 entries across 19 versions & 1 rubygems