Skip to content
Home Β» Blog Β» Script: Change Nameservers at sav.com

Script: Change Nameservers at sav.com

I still owe you the Nameservers script from the Add Domains to sav.com cart post. My bad πŸ˜‚

Note: sav.com offers an API now to change your Nameservers. You might want to check it out too. I just checked my script (30th August 2023) and it’s still working like before. But again, the API would be the ‘legit’ way to do it.

With this script you again have to get your cookie from sav.com and replace YOUR_SAV_COOKIE in the script with the cookie, as explained in the Add Domains to sav.com cart post.

You will also have to download (comes per Email) your domains list from sav.com and save it in the same folder as export.csv.

Note: If you have a larger portfolio with them (10k+ domains), I would suggest you download only the ones you want to change, like a page of 500 for example. Exports of larger portfolios often take ages with sav.com or never reach you.

The domains you want to change must be saved in a .txt file in the same folder (i.e. domains.txt) in the following format:

domain.tld;ralf.ns.cloudflare.com;christian.ns.cloudflare.com


Here’s the script. Save it as ns.sh and make it executable (as described in the Add to cart post)

#!/bin/bash

if [ $# -eq 0 ]
then
    echo "usage: ns.sh domains.txt"
    exit
fi


for LINE in `cat $1`
do
    DOMAIN=`echo $LINE | cut -d";" -f"1"`
    NS_1=`echo $LINE | cut -d";" -f"2"`
    NS_2=`echo $LINE | cut -d";" -f"3"`
    DOMAIN_ID=`cat export.csv | grep "$DOMAIN" | sed "s/\",.*//" | sed "s/\"//"`
    if [ -z "$DOMAIN_ID" ]
    then
	echo "$DOMAIN ID not found, skipping"
	continue
    fi

    echo -n "$DOMAIN $DOMAIN_ID: "

    while :
    do
        RESPONSE=`curl \
        -s \
        --cookie "YOUR_SAV_COOKIE" \
        "https://www.sav.com/domains/update_nameservers_ajax" 2>/dev/null`

        if echo $RESPONSE | grep -q "success"
        then
	    echo -n " OK"
	    break
	else
	    echo -n " retry"
	    sleep 1s
	fi
    done

    echo ""
done


Sav.com often fails when changing the Nameservers. That’s why I added a retry function. It retries to set the Nameservers until they are finally set. πŸ˜‚

You then call the script with:

./ns.sh domains.txt


or whatever you named your domains file.

Hope that helps.

If you have any questions, leave them in the comments or over there at Twitter/X.

Enjoy.

Leave a Reply

Your email address will not be published. Required fields are marked *