#! /usr/bin/env bash sleep 5 export PDNS_RECURSOR_HOST="$(getent hosts ${PDNS_RECURSOR_HOST} | cut -d' ' -f1)" replace_var() { file="${1}" var="${2}" sed -e "s?${var}?${!var}?g" -i "${file}" } replace_vars() { file="${1}" for var in $(cat /etc/vars-vars) do replace_var "${file}" "${var}" done } replace_files() { for file in $(cat /etc/vars-files) do replace_vars "${file}" done } replace_files pdns_server --daemon=no