how to force bind reload all zones after direct change in ispc db table dns_rr?

Discussion in 'Tips/Tricks/Mods' started by radim_h, Aug 29, 2010.

  1. radim_h

    radim_h Member

    Hello,
    hope someone can help me

    I have changed IP adress of my mail server.
    Because there is lot of zone files , i don't want to click changes manualy for all DNS zones in ISPC
    so i changed IPs directly in database as:

    UPDATE dns_rr SET data='1.1.1.2' WHERE name='mail' AND data='1.1.1.1';

    but all zone files in /etc/bind stays unchanged
    i cannot use sed or other script to replace IP adress in zone files, as in this case serial numbers for all zones will stay the same

    how can i force bind to rebuild all zone files?
    ideally delete all old zone files and create new ones with new serial number
    ?

    as there is nothing like UPDATE dns_rr SET status = 'u'; as it was in ISPC2
    i probably aked once for smae thing but cannot find the thread, there was something about remoting but i have no idea how to do this :(
     
    Last edited: Aug 29, 2010
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    You can not change the records directly in the database as all direct changes will be ignored. Only changes that were created trough the ispconfig interface or remoting API will work as only changes that have a event record in the sys_datalog describing the changes values will end up in the config files. If you want to use the remoting api, you will find some example files in the remote_client/examples/ subfolder of the ispconfig tar.gz file.
     
  3. radim_h

    radim_h Member

    which script can i use? can you be more specific, please ?
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    There are no ready made scripts. The Remoting framework is a API for developers.
     
  5. radim_h

    radim_h Member

    so sad, all i needed is force bind to recreate all zone files with new serial..

    weird thing is that i have abouut 300 lines in sys_datalog table with status "pending"
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    The status filed is not used, so the status does not matter. pending is just the default of the field in the database.
     
  7. HellMind

    HellMind Member

    Damn I need to rebuild the cfg and now I must code a script to update the config files :(

    Why till :(
     
  8. HellMind

    HellMind Member

    Code:
    <?php
    $client_id = 0;
    
    $username = '';
    $password = '';
    
    $soap_location = 'http://localhost:8080/remote/index.php';
    $soap_uri = 'http://localhost:8080/remote/';
    
    $client = new SoapClient(null, array('location' => $soap_location, 'uri'      => $soap_uri));
    
    $session_id = $client->login($username,$password);
    
    $regid;
    
    #655 top value
    for ($id = 1; $id <= 655; $id++) {
     echo "<br>$id .. ";
     $dns_record = $client->dns_a_get($session_id, $id);
     if($dns_record['type'] =='A'){
      $affected_rows = $client->dns_a_update($session_id, $client_id, $id, $dns_record);
      echo 'A';
     }
     echo " .. $id";
    }
    if($client->logout($session_id)) {
    echo 'Logged out.<br />';
    }
    
    ?>
    
     
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    Why dont you use the resync tool that is build into ispconfig? See Tools > Resync.
     
    ArnOS likes this.
  10. HellMind

    HellMind Member

    thanks,
    that is what I need
     

Share This Page