My Provider (T-Com) uses dynamic DNS-Server and they changed in the last
time offen, because of maintenance their DNS-Server...
So i get in trouble with my DNS-Lookups from Bind.

Now, i have write a little script to change the ADSLProviderDNS and call
it in /etc/ppp/ip-up.local.
pppd writes the Provider DNS to /etc/ppp/resolve.conf
The script read this file and "inform" the backend of the new
ProviderDNS.
 
-----------------------------------------------------------------
[EMAIL PROTECTED] sbin]# cat changeADSLProviderDNS.pl
#!/usr/bin/perl
# call in /etc/ppp/ip-up.local

use strict;
use Fcntl ':flock'; # contains LOCK_EX (2) and LOCK_UN (8) constants

my $buffer;
my $file;
my $index;
my @line = ();
my $flag;
my $timestamp;

$file = '/etc/ppp/resolv.conf';
$index = 1;

$timestamp = time();
exec `config-wrapper.pl $timestamp -i`;

# open the resolve.conf-file
open(INFILE, $file);

# request an exclusive lock on the file.
flock(INFILE, LOCK_EX);

# read in each line from the file
while (<INFILE>)
{
  # set flag to 1
  $flag = 1;

  # $_ is the line that <INFILE> has set.
  @line = split(' ', $_);

  # check for ADSLProviderDNS 1 + 2
  if ($index < 3) {

    # set the new value
    exec `config-wrapper.pl $timestamp -s ADSLProviderDNS$index
$line[1]`;
    $index = $index + 1;
  }


}

# unlock and close the file.
flock(INFILE, LOCK_UN);
close(INFILE);

# check and commit or abort
if ($flag == 1) {
  exec `event-handler.pl $timestamp ADSLProviderDNS1`;
  exec `config-wrapper.pl $timestamp -c`;
} else {
  exec `config-wrapper.pl $timestamp -a`;
}
-------------------------------------------------------------

improvements or modifications are welcome

greatz 
FrankB


____________________________________________________
Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com
Join the Club : http://www.mandrakeclub.com
____________________________________________________

Reply via email to