pizza1-configs/knot/geodnsupdate
2023-07-30 01:29:04 -07:00

26 lines
694 B
Bash
Executable File

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