From e3ec3eb9a1760a8799929416d681311d35116d7c Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Fri, 12 Sep 2014 08:45:22 +0200 Subject: only run hook if pdnsd is running --- 21-pdnsd | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/21-pdnsd b/21-pdnsd index 6952332..c9a7944 100644 --- a/21-pdnsd +++ b/21-pdnsd @@ -1,23 +1,25 @@ #!/bin/sh - -case "${reason}" in - BOUND|REBIND|REBOOT|RENEW|TIMEOUT|STATIC) - # Set the IP of "dynamic" entry for pdnsd - SRVS="" - for X in ${new_domain_name_servers}; do - if [ -z "${SRVS}" ]; then - SRVS="${X}" - else - SRVS="${SRVS},${X}" - fi - done - pdnsd-ctl server dynamic up ${SRVS} - ;; - PREINIT|EXPIRE|FAIL|IPV4LL|NAK|NOCARRIER|RELEASE|STOP) - # reset to values in /etc/pdnsd.conf - pdnsd-ctl config - ;; - INFORM) - # do nothing here - ;; -esac + +if pdnsd-ctl status >/dev/null 2>/dev/null; then + case "${reason}" in + BOUND|REBIND|REBOOT|RENEW|TIMEOUT|STATIC) + # Set the IP of "dynamic" entry for pdnsd + SRVS="" + for NAMESERVER in ${new_domain_name_servers}; do + if [ -z "${SRVS}" ]; then + SRVS="${NAMESERVER}" + else + SRVS="${SRVS},${NAMESERVER}" + fi + done + pdnsd-ctl server dynamic up ${SRVS} + ;; + PREINIT|EXPIRE|FAIL|IPV4LL|NAK|NOCARRIER|RELEASE|STOP) + # reset to values in /etc/pdnsd.conf + pdnsd-ctl config + ;; + INFORM) + # do nothing here + ;; + esac +fi -- cgit v1.2.3-70-g09d2