Inserting A records in dns zone [closed]

Clash Royale CLAN TAG#URR8PPP
up vote
-1
down vote
favorite
Following is the script we are running.
for x in `cat /root/domain | cut -d: -f1` ; do echo "ns1 14400 IN A $x" >> /var/named/$x.db ; done
The script is inserting the domain but instead of the domain name (Domain1.com), we need the IP (192.0.2.55) to be inserted.
ns1 14400 IN A Domain1.example
We are looking for the below-mentioned data.
ns1 14400 IN A 192.0.2.55
File in content: (domain)
- Domain1.example 192.0.2.55
- Domain2.example 198.51.100.2
EDIT #1
We have around 500 domains and trying to insert A records to the domains with specific IPs.
Example:
- domain1.example 192.0.2.33
- domain2.example 198.51.100.44
- domain3.example 203.0.113.44
The below mentioned script assigns the required records to the domains individually.
$ for x in domain1.com; do echo "ns1 14400 IN A 192.0.2.126" >> /var/named/$x.db; done
We have a file containing the domains and the IPs and we would like to have a script which would assign the records from that file itself in bulk (See the above mentioned example).
Reference link
- https://forums.cpanel.net/threads/bulk-dns-insert.219301/
scripting dns
closed as off-topic by Rui F Ribeiro, slm⦠Jul 7 at 14:06
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question has been posted on multiple sites. Cross-posting is strongly discouraged; see the help center and community FAQ for more information." â slm
add a comment |Â
up vote
-1
down vote
favorite
Following is the script we are running.
for x in `cat /root/domain | cut -d: -f1` ; do echo "ns1 14400 IN A $x" >> /var/named/$x.db ; done
The script is inserting the domain but instead of the domain name (Domain1.com), we need the IP (192.0.2.55) to be inserted.
ns1 14400 IN A Domain1.example
We are looking for the below-mentioned data.
ns1 14400 IN A 192.0.2.55
File in content: (domain)
- Domain1.example 192.0.2.55
- Domain2.example 198.51.100.2
EDIT #1
We have around 500 domains and trying to insert A records to the domains with specific IPs.
Example:
- domain1.example 192.0.2.33
- domain2.example 198.51.100.44
- domain3.example 203.0.113.44
The below mentioned script assigns the required records to the domains individually.
$ for x in domain1.com; do echo "ns1 14400 IN A 192.0.2.126" >> /var/named/$x.db; done
We have a file containing the domains and the IPs and we would like to have a script which would assign the records from that file itself in bulk (See the above mentioned example).
Reference link
- https://forums.cpanel.net/threads/bulk-dns-insert.219301/
scripting dns
closed as off-topic by Rui F Ribeiro, slm⦠Jul 7 at 14:06
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question has been posted on multiple sites. Cross-posting is strongly discouraged; see the help center and community FAQ for more information." â slm
1
do you want to use domain name as file name$x.dband IP address passed into file content?
â RomanPerekhrest
Jul 5 at 12:36
Crossposted stackoverflow.com/q/51023400/4957508
â roaima
Jul 7 at 12:26
add a comment |Â
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
Following is the script we are running.
for x in `cat /root/domain | cut -d: -f1` ; do echo "ns1 14400 IN A $x" >> /var/named/$x.db ; done
The script is inserting the domain but instead of the domain name (Domain1.com), we need the IP (192.0.2.55) to be inserted.
ns1 14400 IN A Domain1.example
We are looking for the below-mentioned data.
ns1 14400 IN A 192.0.2.55
File in content: (domain)
- Domain1.example 192.0.2.55
- Domain2.example 198.51.100.2
EDIT #1
We have around 500 domains and trying to insert A records to the domains with specific IPs.
Example:
- domain1.example 192.0.2.33
- domain2.example 198.51.100.44
- domain3.example 203.0.113.44
The below mentioned script assigns the required records to the domains individually.
$ for x in domain1.com; do echo "ns1 14400 IN A 192.0.2.126" >> /var/named/$x.db; done
We have a file containing the domains and the IPs and we would like to have a script which would assign the records from that file itself in bulk (See the above mentioned example).
Reference link
- https://forums.cpanel.net/threads/bulk-dns-insert.219301/
scripting dns
Following is the script we are running.
for x in `cat /root/domain | cut -d: -f1` ; do echo "ns1 14400 IN A $x" >> /var/named/$x.db ; done
The script is inserting the domain but instead of the domain name (Domain1.com), we need the IP (192.0.2.55) to be inserted.
ns1 14400 IN A Domain1.example
We are looking for the below-mentioned data.
ns1 14400 IN A 192.0.2.55
File in content: (domain)
- Domain1.example 192.0.2.55
- Domain2.example 198.51.100.2
EDIT #1
We have around 500 domains and trying to insert A records to the domains with specific IPs.
Example:
- domain1.example 192.0.2.33
- domain2.example 198.51.100.44
- domain3.example 203.0.113.44
The below mentioned script assigns the required records to the domains individually.
$ for x in domain1.com; do echo "ns1 14400 IN A 192.0.2.126" >> /var/named/$x.db; done
We have a file containing the domains and the IPs and we would like to have a script which would assign the records from that file itself in bulk (See the above mentioned example).
Reference link
- https://forums.cpanel.net/threads/bulk-dns-insert.219301/
scripting dns
edited Jul 7 at 22:21
Patrick Mevzek
2,0131721
2,0131721
asked Jul 5 at 12:16
techforever92
66
66
closed as off-topic by Rui F Ribeiro, slm⦠Jul 7 at 14:06
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question has been posted on multiple sites. Cross-posting is strongly discouraged; see the help center and community FAQ for more information." â slm
closed as off-topic by Rui F Ribeiro, slm⦠Jul 7 at 14:06
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question has been posted on multiple sites. Cross-posting is strongly discouraged; see the help center and community FAQ for more information." â slm
1
do you want to use domain name as file name$x.dband IP address passed into file content?
â RomanPerekhrest
Jul 5 at 12:36
Crossposted stackoverflow.com/q/51023400/4957508
â roaima
Jul 7 at 12:26
add a comment |Â
1
do you want to use domain name as file name$x.dband IP address passed into file content?
â RomanPerekhrest
Jul 5 at 12:36
Crossposted stackoverflow.com/q/51023400/4957508
â roaima
Jul 7 at 12:26
1
1
do you want to use domain name as file name
$x.db and IP address passed into file content?â RomanPerekhrest
Jul 5 at 12:36
do you want to use domain name as file name
$x.db and IP address passed into file content?â RomanPerekhrest
Jul 5 at 12:36
Crossposted stackoverflow.com/q/51023400/4957508
â roaima
Jul 7 at 12:26
Crossposted stackoverflow.com/q/51023400/4957508
â roaima
Jul 7 at 12:26
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
1
down vote
Problem is with delimiter : in cut, which does not exist.
Try,
for x in `awk 'print $2' /root/domain ` ; do echo "ns1 14400 IN A $x" >> /var/named/$x.db ; done
add a comment |Â
up vote
0
down vote
This can be done with pure bash:
while read a x; do [ -n "$x" ] && echo "ns1 14400 IN A $x" >>/var/named/$x.db ; done <file
read a x: assign the first word to$aand the second word to$x.[ -n "$x" ]: if$xis not emptyecho "..." >>append to the desired file.<file:fileis the input file with the domains and IPs.
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
Problem is with delimiter : in cut, which does not exist.
Try,
for x in `awk 'print $2' /root/domain ` ; do echo "ns1 14400 IN A $x" >> /var/named/$x.db ; done
add a comment |Â
up vote
1
down vote
Problem is with delimiter : in cut, which does not exist.
Try,
for x in `awk 'print $2' /root/domain ` ; do echo "ns1 14400 IN A $x" >> /var/named/$x.db ; done
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Problem is with delimiter : in cut, which does not exist.
Try,
for x in `awk 'print $2' /root/domain ` ; do echo "ns1 14400 IN A $x" >> /var/named/$x.db ; done
Problem is with delimiter : in cut, which does not exist.
Try,
for x in `awk 'print $2' /root/domain ` ; do echo "ns1 14400 IN A $x" >> /var/named/$x.db ; done
answered Jul 5 at 12:21
SivaPrasath
3,69811636
3,69811636
add a comment |Â
add a comment |Â
up vote
0
down vote
This can be done with pure bash:
while read a x; do [ -n "$x" ] && echo "ns1 14400 IN A $x" >>/var/named/$x.db ; done <file
read a x: assign the first word to$aand the second word to$x.[ -n "$x" ]: if$xis not emptyecho "..." >>append to the desired file.<file:fileis the input file with the domains and IPs.
add a comment |Â
up vote
0
down vote
This can be done with pure bash:
while read a x; do [ -n "$x" ] && echo "ns1 14400 IN A $x" >>/var/named/$x.db ; done <file
read a x: assign the first word to$aand the second word to$x.[ -n "$x" ]: if$xis not emptyecho "..." >>append to the desired file.<file:fileis the input file with the domains and IPs.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
This can be done with pure bash:
while read a x; do [ -n "$x" ] && echo "ns1 14400 IN A $x" >>/var/named/$x.db ; done <file
read a x: assign the first word to$aand the second word to$x.[ -n "$x" ]: if$xis not emptyecho "..." >>append to the desired file.<file:fileis the input file with the domains and IPs.
This can be done with pure bash:
while read a x; do [ -n "$x" ] && echo "ns1 14400 IN A $x" >>/var/named/$x.db ; done <file
read a x: assign the first word to$aand the second word to$x.[ -n "$x" ]: if$xis not emptyecho "..." >>append to the desired file.<file:fileis the input file with the domains and IPs.
answered Jul 5 at 13:34
chaos
33.5k767112
33.5k767112
add a comment |Â
add a comment |Â
1
do you want to use domain name as file name
$x.dband IP address passed into file content?â RomanPerekhrest
Jul 5 at 12:36
Crossposted stackoverflow.com/q/51023400/4957508
â roaima
Jul 7 at 12:26