Mass Update TTL Settings at Once Easily with WHM/Cpanel

Yesterday I moved servers and had to update the TTL settings on about 100 accounts on my server. There is no method for doing this with WHM/Cpanel but using the command line and ssh you can do this really easily in about 2 minutes... here is how.

Firstly If you are not familiar with the command line - make sure you have SSH turned on in your WHM settings. Then open a terminal (if using Linux) or download putty (if using Windows) and use these commands.

Firstly to login ssh root@???.???.???.???Substitute the question marks for your IP number. Then it will ask to add this IP to a list of secure IP's - type yes (or y). Then it will prompt for your password (your server root password), type it in and you are now connected to your server via ssh. You have huge control over nearly everything on the server now.

Next browse to the folder where you keep your DNS zones because you are going to update the TTL settings on all of them simultaneously. Browse using the cd (change directory command. Zone files are normally found at /var/names so change directory to there like this. cd ../../var/named The ../../ makes sure you are in the root directory before beginning. Now check you are in the right directory by listing files like this ls -a This will list all files. If you see all the files ending with .db then you know you are in the right place.

Next you are going to replace information in all these files at once.... but you may need to do it 2 or 3 times for the various settings. First replace all TTL settings of 14400 and change then to 300 like this. replace "14400" "300" -- *.db This changes every instance of 14400 to 300 in every single file in that directory... easy hey!

Next repeat the same procedure for every instance of other TTL settings like 84600 for example and any other setting you may have used. replace "84600" "300" -- *.db

The replace command can work with any kind of file, not just .db files - if you wanted to wildcard to all files, not just those with a .db ending you would instead do it like this replace "what to find" "what to change to" -- *.* This will wildcard every file in the folder you are in.

How easy is that... with this command you can update your TTL settings on all accounts in just 2 minutes.

Add new comment

Full HTML

  • Lines and paragraphs break automatically.
  • You may post PHP code. You should include <?php ?> tags.
  • Web page addresses and e-mail addresses turn into links automatically.

Filtered HTML

  • Lines and paragraphs break automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • You may post PHP code. You should include <?php ?> tags.
  • Web page addresses and e-mail addresses turn into links automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.