You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435
  1. #! /usr/bin/env bash
  2. sleep 5
  3. export PDNS_RECURSOR_HOST="$(getent hosts ${PDNS_RECURSOR_HOST} | cut -d' ' -f1)"
  4. . /common.sh
  5. replace_files
  6. for index in {1..2}
  7. do
  8. index=SLAVE"${index}"
  9. pg_disabled=POSTGRES_DISABLED_"${index}"
  10. pg_host=POSTGRES_HOST_"${index}"
  11. if [ "${!pg_disabled}" != 1 ] && [ "${!pg_host}" != "" ]
  12. then
  13. echo "Found slave ${index}"
  14. pg_db=POSTGRES_DB_"${index}"
  15. pg_user=POSTGRES_USER_"${index}"
  16. pg_pwd=POSTGRES_PASSWORD_"${index}"
  17. cat << EOF >> /etc/powerdns/pdns.conf
  18. launch+=gpgsql:slave${index}
  19. gpgsql-slave${index}-host=${!pg_host}
  20. gpgsql-slave${index}-port=
  21. gpgsql-slave${index}-dbname=${!pg_db}
  22. gpgsql-slave${index}-user=${!pg_user}
  23. gpgsql-slave${index}-password=${!pg_pwd}
  24. gpgsql-slave${index}-dnssec=yes
  25. EOF
  26. fi
  27. done
  28. pdns_server --daemon=no