Method: Puppet::Daemon#set_signal_traps
- Defined in:
- lib/puppet/daemon.rb
#set_signal_traps ⇒ Object
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.
Trap a couple of the main signals. This should probably be handled in a way that anyone else can register callbacks for traps, but, eh.
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/puppet/daemon.rb', line 109 def set_signal_traps [:INT, :TERM].each do |signal| Signal.trap(signal) do Puppet.notice "Caught #{signal}; exiting" stop end end # extended signals not supported under windows unless Puppet::Util::Platform.windows? signals = { :HUP => :restart, :USR1 => :reload, :USR2 => :reopen_logs } signals.each do |signal, method| Signal.trap(signal) do Puppet.notice "Caught #{signal}; storing #{method}" @signals << method end end end end |