Class: EtcdTools::Watchdog::Init
- Inherits:
-
Object
- Object
- EtcdTools::Watchdog::Init
- Defined in:
- lib/etcd-tools/watchdog/init.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize ⇒ Init
constructor
A new instance of Init.
Methods included from Threads
Methods included from Etcd
Methods included from Helpers
#arp, #arping, #hostname, #iproute
Methods included from Logger
Constructor Details
#initialize ⇒ Init
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/etcd-tools/watchdog/init.rb', line 24 def initialize @semaphore = { log: Mutex.new, etcd: Mutex.new } @config = { debug: false } @config = config @exit = false # handle various signals @exit_sigs = ['INT', 'TERM'] @exit_sigs.each { |sig| Signal.trap(sig) { @exit = true } } Signal.trap('USR1') { @config[:debug] = false } Signal.trap('USR2') { @config[:debug] = true } Signal.trap('HUP') { @config = config } if RUBY_VERSION >= '2.1' Process.setproctitle('etcd-vip-watchdog') else $0 = 'etcd-vip-watchdog' end # Process.setpriority(Process::PRIO_PROCESS, 0, -20) # Process.daemon end |