mirror of
https://github.com/cmur2/dyndnsd.git
synced 2025-08-07 22:33:55 +02:00
Fiat lux
This commit is contained in:
21
lib/dyndnsd/updater/command_with_bind_zone.rb
Normal file
21
lib/dyndnsd/updater/command_with_bind_zone.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
module Dyndnsd
|
||||
module Updater
|
||||
class CommandWithBindZone
|
||||
def initialize(config)
|
||||
@zone_file = config['zone_file']
|
||||
@command = config['command']
|
||||
@generator = Generator::Bind.new(config)
|
||||
end
|
||||
|
||||
def update(zone)
|
||||
# write zone file in bind syntax
|
||||
File.open(@zone_file, 'w') { |f| f.write(@generator.generate(zone)) }
|
||||
# call user-defined command
|
||||
pid = fork do
|
||||
exec @command
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user