-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpopulate-ALL-domains-dnsrecords-from-template.bash
executable file
·61 lines (53 loc) · 1.48 KB
/
populate-ALL-domains-dnsrecords-from-template.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
QUIET=false
CURRENTDOMAIN=""
DOMAINSLIST=""
fetchDomainsList(){
./fetch-domains-list.bash -q
}
showUsage(){
# Display Help
echo "Hi! Please specify options."
echo
echo "Syntax: fetch-domains-list.bash [-q|h]"
echo "options:"
echo "-h --help Print this Help."
echo "-q --quiet Execute quietly."
echo
}
while getopts ":hq" option; do
case $option in
h) # display Help
showUsage
exit 1;;
q) # quiet
QUIET=true
shift;;
\?) # Invalid option
echo "Error: Invalid option"
showUsage
exit
esac
done
populateAllDomainsDnsRecords(){
# Populate or update the domains.list
fetchDomainsList
# read domainlist
domianListFile="data/domains.list"
DOMAINSLIST=$(cat $domianListFile)
# iterate through $DOMAINSLIST and find dnsrecords for each domain
#echo "$DOMAINSLIST"
for domain in $DOMAINSLIST
do
CURRENTDOMAIN="$domain"
# echo "Records for: $domain"
export NODE_NO_WARNINGS=1
(bash ./remove-all-dnsrecords-from-domain.bash -d $domain -q -x ; bash ./populate-domain-dnsrecords-from-template.bash -d $domain -q -x) &
# clean up global garbage
CURRENTDOMAIN=""
done
}
populateAllDomainsDnsRecords
# using cloudflare-cli - install with `npm install cloudflare-cli`
# https://github.com/danielpigott/cloudflare-cli
# https://github.com/shakes80/cloudflare-cli