This package is the public YaST2 API to configure the Bind version 9
Immediatelly stops the DNS service. Returns nonzero if operation succeeded, zero if operation failed.
Example 98.
my $status = StopDnsService ({});
if ($status == 0)
{
print "Stopping DNS server failed";
}
else
{
print "Stopping DNS server succeeded";
}Immediatelly starts the DNS service. Returns nonzero if operation succeeded, zero if operation failed.
Example 99.
my $status = StartDnsService ({});
if ($status == 0)
{
print "Starting DNS server failed";
}
else
{
print "Starting DNS server succeeded";
}Check if DNS service is running. Returns nonzero if service is running, zero otherwise.
Example 100.
my $status = GetDnsServiceStatus ({});
if ($status == 0)
{
print "DNS server is not running";
}
else
{
print "DNS server is running";
}Reads all global options of the DNS server.
Example 101.
my $options = ReadGlobalOptions ({});
if (! defined ($options))
{
print "Reading options failed";
}
else
{
foreach my $option (@{$options}) {
my $key = $option->{"key"};
my $value = $option->{"value"};
print "Have global option $key with value $value";
}
}Writes all global options of the DNS server. The taken argument has the same structure as return value of ReadGlobalOptions function.
Example 102.
my $options = [
{
"key" => "dump-file",
"value" => "\"/var/log/named_dump.db\"",
},
{
"key" => "statistics-file",
"value" => "\"/var/log/named.stats\"",
},
]
$success = WriteGlobalOptions ({}, $options);Reads all zones of the DNS server.
Example 103.
my $zones = ReadZones ({});
if (! defined ($zones))
{
print ("Could not read zones");
}
else
{
my $count = @{$zones};
print "Maintaining $count zones";
}Writes all zones to the DNS server, removes zones that are not mentioned in the argument. The structrure of the argument is clear from the example below.
Example 104.
my $zones = [
{
'options' => [
{
'value' => 'master',
'key' => 'type'
},
{
'value' => '"localhost.zone"',
'key' => 'file'
}
],
'zone' => 'localhost',
'ttl' => '1W',
'records' => [
{
'value' => '127.0.0.1',
'type' => 'A',
'key' => 'localhost.'
},
{
'value' => '@',
'type' => 'NS',
'key' => 'localhost.'
}
],
'file' => 'localhost.zone',
'type' => 'master',
'soa' => {
'minimum' => '1W',
'expiry' => '6W',
'serial' => 2004012701,
'zone' => '@',
'retry' => '4H',
'refresh' => '2D',
'mail' => 'root',
'server' => '@'
}
}
];
WriteZones ({}, $zones);