1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

Plesk API - dns.sh - how ?

Discussion in 'Plesk for Linux - 8.x and Older' started by madsere, Oct 8, 2005.

  1. madsere

    madsere Regular Pleskian

    26
    57%
    Joined:
    May 8, 2005
    Messages:
    200
    Likes Received:
    0
    Nameservers changed for all sites on one of my Plesk servers and I now have to modify all the NS records.

    Rather than spending the rest of my life doing the point and click shuffle I was trying to use the dns.sh script from ftp://download1.sw-soft.com/Plesk/Plesk7.5/Doc/plesk-7.5r-sdk-html/docs/cu/unix/ch08.html - but the documentation might as well have been in Russian.

    dns.sh command <domain_name> [-a -ip | -ns -nameserver | -mx -mailexchanger -priority | -cname -canonical | -ptr -subnet | -txt -domain ]

    Logically I'd expect something like

    dns.sh -d mydomain.com -ns myoldnameserver.com

    to delete an old nameserver entry but it complains about missing -nameserver. Adding that just gives another error. Maybe one of the Plesk gurus can clarify the syntax (and fix the documentation) ?
     
  2. jamesyeeoc

    jamesyeeoc Guest

    0
     
    The dns.sh is for creating one DNS record at a time. Examples:

    dns.sh --add "domain.com" -a "mail" -ip "xx.yy.zz.aa"

    dns.sh --add "domain.com" -a "webmail" -ip "xx.yy.zz.aa"

    dns.sh --add "domain.com" -mx "mail" -mailexchanger "domain.com" -priority "10"

    These would create 3 records.

    Each option such as -mx <value> may require an additional option, in this case -priority <value>

    Their docs could use a lot more polishing, but if you read it very very literally, you'll get it.


    dns.sh command <domain_name> [-a -ip | -ns -nameserver | -mx -mailexchanger -priority | -cname -canonical | -ptr -subnet | -txt -domain ]
    (remember, the pipe char means 'or')
    This means that on each run of the command, you would pick one of the following combinations (and only a single combination):

    -a -ip
    -ns -nameserver
    -mx -mailexchanger -priority
    -cname -canonical
    -ptr -subnet
    -txt -domain

    And whichever one you pick, you must include all parts (mx has 3 parts). So if you want to create 10 DNS records, you will have to do 10 calls to dns.sh with the appropriate arguments...

    Clear as mud, right? Hope this helps.
     
  3. madsere

    madsere Regular Pleskian

    26
    57%
    Joined:
    May 8, 2005
    Messages:
    200
    Likes Received:
    0
    I think perhaps my question wasn't clear enough.

    I just wanted to know the proper syntax for adding/deleting NS records. Some trial and error and I found it to be this:

    dns.sh --del <zone> -ns "" -nameserver <nameserver>
    dns.sh --add <zone> -ns "" -nameserver <nameserver>

    It is curious that the -ns switch must have an empty quote for this command to work, but this is how it works for me.
     
  4. dm__@

    dm__@ Guest

    0
     
    This is due to fact that names after -ns and other similar options are relative to the domain name. See the corresponding actions in web-interface.
     
Loading...