Method: Deamons::Geth#write_pid_file

Defined in:
lib/Deamons/geth.rb

#write_pid_file(pid, pidfile) ⇒ Integer and File

Attempts to write the pid of the forked process to the pid file.

Parameters:

  • pid (Integer)
  • pidfile (String)

Returns:

  • (Integer and File)


33
34
35
36
37
38
39
40
# File 'lib/Deamons/geth.rb', line 33

def write_pid_file(pid, pidfile)
  File.open pidfile, "w" do |f|
    f.write pid
  end
rescue ::Exception => e
  $stderr.puts "While writing the PID to file, unexpected #{e.class}: #{e}"
  Process.kill "HUP", pid
end