Revert [606cfc2003] as the parsing code relies on the trailing newline.
[openresolv] / named.in
index 3ed7a556139b2d02ebde20e646b24c666b86f487..de61906aef14a394dc4ebefc7d760dd10c981084 100644 (file)
--- a/named.in
+++ b/named.in
@@ -46,6 +46,11 @@ then
        fi
 fi
 : ${named_service:=named}
        fi
 fi
 : ${named_service:=named}
+
+: ${named_pid:=/var/run/$named_service.pid}
+[ -s "$named_pid" ] || named_pid=/var/run/$named_service/$named_service.pid
+[ -s "$named_pid" ] || unset named_pid
+
 newoptions="# Generated by resolvconf$NL"
 newzones="$newoptions"
 
 newoptions="# Generated by resolvconf$NL"
 newzones="$newoptions"
 
@@ -100,7 +105,14 @@ if [ -n "$named_zones" ]; then
        fi
 fi
 
        fi
 fi
 
+# Try to send SIGHUP first
+if $changed && [ -s "$named_pid" ]; then
+       echo "SENDING HUP"
+       kill -SIGHUP $(cat "$named_pid") && changed=false
+fi
+
 if $changed; then
 if $changed; then
+       echo "RESTARTING"
        if [ -n "$named_restart" ]; then
                eval $named_restart
        elif [ -n "$RESTARTCMD" ]; then
        if [ -n "$named_restart" ]; then
                eval $named_restart
        elif [ -n "$RESTARTCMD" ]; then