pizza1-configs/knot/geodnsupdate

26 lines
694 B
Plaintext
Raw Normal View History

2023-04-16 03:35:37 -07:00
#!/usr/bin/env bash
2023-07-30 01:29:04 -07:00
remote='cdn@us.vpn.projectsegfau.lt'
2023-04-16 03:35:37 -07:00
geoconf=/etc/knot/geo.conf
2023-07-30 01:29:04 -07:00
domainsfile=/var/geodnsdomains
soltemplate=/configs/knot/soltemplate
pizzatemplate=/configs/knot/pizzatemplate
restemplate=/configs/knot/geodnstemplate
2023-04-16 03:35:37 -07:00
printf '' > $geoconf
2023-07-30 01:29:04 -07:00
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 03:35:37 -07:00
done
2023-07-30 01:29:04 -07:00
2023-04-16 03:35:37 -07:00
scp $geoconf "${remote}":/var/geo.conf
ssh $remote "sudo systemctl restart knot"
systemctl restart knot