2023-04-16 16:05:37 +05:30
|
|
|
#!/usr/bin/env bash
|
2023-07-30 13:59:04 +05:30
|
|
|
remote='cdn@us.vpn.projectsegfau.lt'
|
2023-04-16 16:05:37 +05:30
|
|
|
geoconf=/etc/knot/geo.conf
|
2023-07-30 13:59:04 +05:30
|
|
|
domainsfile=/var/geodnsdomains
|
|
|
|
soltemplate=/configs/knot/soltemplate
|
|
|
|
pizzatemplate=/configs/knot/pizzatemplate
|
|
|
|
restemplate=/configs/knot/geodnstemplate
|
2023-04-16 16:05:37 +05:30
|
|
|
printf '' > $geoconf
|
2023-07-30 13:59:04 +05:30
|
|
|
for i in $(<$domainsfile); do
|
|
|
|
cat $restemplate >> $geoconf
|
|
|
|
while IFS=, read -r dom ser; do
|
|
|
|
domain=$dom
|
|
|
|
server=$ser
|
|
|
|
done < <(echo ${i})
|
|
|
|
if [[ $server == "pizza1" ]]; then
|
|
|
|
cat $pizzatemplate >> $geoconf
|
|
|
|
elif [[ $server == "soleil" ]]; then
|
|
|
|
cat $soltemplate >> $geoconf
|
|
|
|
fi
|
|
|
|
sed -i "s/REPLACEME/${domain}/" $geoconf
|
2023-04-16 16:05:37 +05:30
|
|
|
done
|
2023-07-30 13:59:04 +05:30
|
|
|
|
2023-04-16 16:05:37 +05:30
|
|
|
scp $geoconf "${remote}":/var/geo.conf
|
|
|
|
ssh $remote "sudo systemctl restart knot"
|
|
|
|
systemctl restart knot
|