Method: Puppet::Daemon#daemonize

Defined in:
lib/puppet/daemon.rb

#daemonizeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Put the daemon into the background.



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/puppet/daemon.rb', line 41

def daemonize
  pid = fork
  if pid
    Process.detach(pid)
    exit(0)
  end

  create_pidfile

  # Get rid of console logging
  Puppet::Util::Log.close(:console)

  Process.setsid
  Dir.chdir("/")

  close_streams
end