parent
b8e87c8836
commit
52e358782c
@ -6,17 +6,15 @@ set -e
|
|||||||
# treat everything except -- as exec cmd
|
# treat everything except -- as exec cmd
|
||||||
[ "${1:0:2}" != "--" ] && exec "$@"
|
[ "${1:0:2}" != "--" ] && exec "$@"
|
||||||
|
|
||||||
# Set MySQL Credentials in pdns.conf
|
|
||||||
if $MYSQL_AUTOCONF ; then
|
if $MYSQL_AUTOCONF ; then
|
||||||
|
# Set MySQL Credentials in pdns.conf
|
||||||
sed -r -i "s/^[# ]*gmysql-host=.*/gmysql-host=${MYSQL_HOST}/g" /etc/pdns/pdns.conf
|
sed -r -i "s/^[# ]*gmysql-host=.*/gmysql-host=${MYSQL_HOST}/g" /etc/pdns/pdns.conf
|
||||||
sed -r -i "s/^[# ]*gmysql-port=.*/gmysql-port=${MYSQL_PORT}/g" /etc/pdns/pdns.conf
|
sed -r -i "s/^[# ]*gmysql-port=.*/gmysql-port=${MYSQL_PORT}/g" /etc/pdns/pdns.conf
|
||||||
sed -r -i "s/^[# ]*gmysql-user=.*/gmysql-user=${MYSQL_USER}/g" /etc/pdns/pdns.conf
|
sed -r -i "s/^[# ]*gmysql-user=.*/gmysql-user=${MYSQL_USER}/g" /etc/pdns/pdns.conf
|
||||||
sed -r -i "s/^[# ]*gmysql-password=.*/gmysql-password=${MYSQL_PASS}/g" /etc/pdns/pdns.conf
|
sed -r -i "s/^[# ]*gmysql-password=.*/gmysql-password=${MYSQL_PASS}/g" /etc/pdns/pdns.conf
|
||||||
sed -r -i "s/^[# ]*gmysql-dbname=.*/gmysql-dbname=${MYSQL_DB}/g" /etc/pdns/pdns.conf
|
sed -r -i "s/^[# ]*gmysql-dbname=.*/gmysql-dbname=${MYSQL_DB}/g" /etc/pdns/pdns.conf
|
||||||
fi
|
|
||||||
|
|
||||||
|
MYSQLCMD="mysql --host='${MYSQL_HOST}' --user='${MYSQL_USER}' --password='${MYSQL_PASS}' -r -N"
|
||||||
MYSQLCMD="mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -r -N"
|
|
||||||
|
|
||||||
# wait for Database come ready
|
# wait for Database come ready
|
||||||
isDBup () {
|
isDBup () {
|
||||||
@ -44,9 +42,12 @@ if [ "$(echo "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema
|
|||||||
cat /etc/pdns/schema.sql | $MYSQLCMD
|
cat /etc/pdns/schema.sql | $MYSQLCMD
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
unset -v MYSQL_PASS
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run pdns server
|
||||||
trap "pdns_control quit" SIGHUP SIGINT SIGTERM
|
trap "pdns_control quit" SIGHUP SIGINT SIGTERM
|
||||||
|
|
||||||
pdns_server "$@" &
|
pdns_server "$@" &
|
||||||
|
|
||||||
wait
|
wait
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user