]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
Start unbound+DHCP bridge only when DHCP server is running
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 12 Sep 2016 19:20:08 +0000 (20:20 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 12 Sep 2016 19:36:51 +0000 (20:36 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/initscripts/init.d/dhcp
src/initscripts/init.d/unbound

index 083a555a3a5c9c01147d21f09d307e39fd30294c..2182bc4b3a39cf8af4e5efe0a6180d1e1d8d9519 100644 (file)
@@ -7,7 +7,9 @@
 
 . /etc/sysconfig/rc
 . $rc_functions
+
 eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
+eval $(/usr/local/bin/readhash /var/ipfire/dhcp/settings)
 
 function flush_chains() {
        iptables -F DHCPGREENINPUT
@@ -36,6 +38,12 @@ case "$1" in
                boot_mesg "Starting DHCP Server..."
                loadproc /usr/sbin/dhcpd -q ${devices}
 
+               # Start Unbound DHCP Lease Bridge unless RFC2136 is used
+               if [ "${DNS_UPDATE_ENABLED}" != on ]; then
+                       boot_mesg "Starting Unbound DHCP Leases Bridge..."
+                       loadproc /usr/sbin/unbound-dhcp-leases-bridge -d
+               fi
+
                (sleep 5 && chmod 644 /var/run/dhcpd.pid) & # Fix because silly dhcpd creates its pid with mode 640
                ;;
 
@@ -52,6 +60,9 @@ case "$1" in
                    echo_ok;
                    exit 0
                fi
+
+               boot_mesg "Stopping Unbound DHCP Leases Bridge..."
+               killproc /usr/sbin/unbound-dhcp-leases-bridge
                ;;
 
        reload)
@@ -67,6 +78,7 @@ case "$1" in
 
        status)
                statusproc /usr/sbin/dhcpd
+               statusproc /usr/sbin/unbound-dhcp-leases-bridge
                ;;
 
        *)
index f3d35cf4888775b9a3accf014a5b7603f513087f..a29864a3babd0929803dc9077cd0a6fa98f97252 100644 (file)
@@ -3,9 +3,6 @@
 
 # Description : Unbound DNS resolver boot script for IPfire
 # Author      : Marcel Lorenz <marcel.lorenz@ipfire.org>
-#
-# Comment     : This init script additional starts the dhcpd watcher daemon
-#               if DNS-Update (RFC2136) in web interface enabled
 
 . /etc/sysconfig/rc
 . ${rc_functions}
@@ -169,7 +166,6 @@ get_memory_amount() {
 case "$1" in
        start)
                eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
-               eval $(/usr/local/bin/readhash /var/ipfire/dhcp/settings)
 
                # Create control keys at first run
                if [ ! -r "/etc/unbound/unbound_control.key" ]; then
@@ -186,18 +182,9 @@ case "$1" in
 
                # Update any known forwarding name servers
                update_forwarders
-
-               # Start Unbound DHCP Lease Bridge unless RFC2136 is used
-               if [ "${DNS_UPDATE_ENABLED}" != on ]; then
-                       boot_mesg "Starting Unbound DHCP Leases Bridge..."
-                       loadproc /usr/sbin/unbound-dhcp-leases-bridge -d
-               fi
                ;;
 
        stop)
-               boot_mesg "Stopping Unbound DHCP Leases Bridge..."
-               killproc /usr/sbin/unbound-dhcp-leases-bridge
-
                boot_mesg "Stopping Unbound DNS Proxy..."
                killproc /usr/sbin/unbound
                ;;
@@ -210,7 +197,6 @@ case "$1" in
 
        status)
                statusproc /usr/sbin/unbound
-               statusproc /usr/sbin/unbound-dhcp-leases-bridge
                ;;
 
        update-forwarders)