class Dyndnsd::Updater::CommandWithBindZone
Public Class Methods
new(domain, updater_params)
click to toggle source
@param domain [String] @param updater_params [Hash{String => Object}]
# File lib/dyndnsd/updater/command_with_bind_zone.rb, line 8 def initialize(domain, updater_params) @zone_file = updater_params['zone_file'] @command = updater_params['command'] @generator = Generator::Bind.new(domain, updater_params) end
Public Instance Methods
update(db)
click to toggle source
@param db [Dyndnsd::Database] @return [void]
# File lib/dyndnsd/updater/command_with_bind_zone.rb, line 16 def update(db) # do not regenerate zone file (assumed to be persistent) if DB did not change return if !db.changed? Helper.span('updater_update') do |span| span.set_attribute('dyndnsd.updater.name', self.class.name&.split('::')&.last || 'None') # write zone file in bind syntax File.write(@zone_file, @generator.generate(db)) # call user-defined command pid = fork do exec @command end # detach so children don't become zombies Process.detach(pid) if pid end end