Hey guys,
I have a question, I am aware this does not update the Serial but that is okay, because I have another way to handle that, My plan for the update of serial is the following
basically reading from a domain list which I have grabbed by ls through the /var/named and put into a domainlist, fair enough. I also know how I remove that, I will just do this
This basically gets me where I need to go, to use the WHMAPI to add a dummy record, and remove that same added record from the zones and thus update the serial. Here is my problem
I have ns3 and ns4.y.com, I have already implemented 2 new nameservers, Im doing a switch, that im deprecating these, how could SED or using any other way to find all the lines that are "IN NS ns3.y.com." with the spaces, so I can take that line and "cut/delete" it out of the file first, the whmapi does not work here becauseit depends on "line number", my method above to add and delete the dummy record hinges on adding it and deleting it right away -1 line.
I need a way to use linux terminal tool most likely to grep this line in each file not based on domain but based on that specific "IN NS ns3.y.com" find it and DELETE the whole line and its empty line space.
How can I best do this, I need to do this then add the WHMAPI and delete, to update the serial, the reason for that is because I don't want to update the serial using linux because it has to update the SERIAL but then pass it through the cluster to the main central nameservers, that is why WHMAPI comes in handy.
Any help is appreciated, a code that can help me isolate each of these lines, delete them and the leftover blank space.
I have a question, I am aware this does not update the Serial but that is okay, because I have another way to handle that, My plan for the update of serial is the following
Code:
for i in $(cat /diskar/domainlist);
do
echo whmapi1 addzonerecord domain=$i name=dummy123.$i. class=IN ttl=14400 type=TXT txtdata="dummy"
done
Code:
for x in $(cat /diskar/domainlist);
do
for i in $(cat /var/named/$x.db | wc -l)
do
echo whmapi1 removezonerecord zone=$x line=$(($i - 1))
done
done
Code:
x.com. 86400 IN NS ns3.y.com.
x.com. 86400 IN NS ns4.y.com.
x.com. 14400 IN A 127.0.0.1
I need a way to use linux terminal tool most likely to grep this line in each file not based on domain but based on that specific "IN NS ns3.y.com" find it and DELETE the whole line and its empty line space.
How can I best do this, I need to do this then add the WHMAPI and delete, to update the serial, the reason for that is because I don't want to update the serial using linux because it has to update the SERIAL but then pass it through the cluster to the main central nameservers, that is why WHMAPI comes in handy.
Any help is appreciated, a code that can help me isolate each of these lines, delete them and the leftover blank space.