Knowledgebase

check domain is working or not

Posted by minosjl, 11-14-2011, 03:28 PM
Hello All, I would like to check my shared server domains is still pointed to my server ip or not using a shell script.Is anybody can help on this.I have little awareness about the shell scripts. My server is cpanel installed one and i have a file that contains the names of domains and need to ping each of this domains and if the ping works , i need to compare the ip to the server ip address list , if both of the are valid , i need to write the domain name in to an another file name like mydomain.txt other wise write it on another file invalid.txt. Please help me on this.....

Posted by webstartavenue, 11-15-2011, 12:06 AM
Assuming you are on linux you can easily get the server ip address via the "host" command. You can then pipe this to grep and sed to quickly get the ip address. Although this can be refined, here is the quickest one-liner I could come up with: From there you'll just need an if statement and a file output.

Posted by minosjl, 11-15-2011, 05:14 PM
nice one , i run this command and i am able to sort the ip address, now i need to check this ip against by server ip list , if its matches , i need to write this on one file other wise discard the domain name . How could do that ?

Posted by minosjl, 11-17-2011, 10:30 AM
thanks i didn't noticed the below comment

Posted by mattmackman, 12-28-2011, 03:38 AM
You can also dig command dig A +short domainname



Was this answer helpful?

Add to Favourites Add to Favourites

Print this Article Print this Article

Also Read
UKServers down (Views: 631)
PHP using sessions (Views: 629)
UBERHOST anyone? (Views: 647)
Reasonable price? (Views: 576)


Language:

Client Login

Email

Password

Remember Me

Search