Save on a fork when restarting services.
authorRoy Marples <roy@marples.name>
Tue, 21 Apr 2009 16:08:43 +0000 (16:08 +0000)
committerRoy Marples <roy@marples.name>
Tue, 21 Apr 2009 16:08:43 +0000 (16:08 +0000)
dnsmasq.in
libc.in
named.in
pdns_recursor.in

index f10c331327b0878693ecc4adae5e8b8a4b654b9d..56f0e8ef1ffea9cf2e79c171a50f8e4de9d8a54e 100644 (file)
@@ -107,7 +107,13 @@ else
        printf "$newresolv" >"$dnsmasq_resolv"
 fi
 
-$changed && $RESOLVCONF -s dnsmasq restart
+if $changed; then
+       if [ "$(command -v service)" = service ]; then
+               service dnsmasq restart
+       else
+               $RESOLVCONF -s dnsmasq restart
+       fi
+fi
 if $dbus; then
        $restart || kill -HUP $(cat "$dnsmasqpid")
        # Send even if empty so old servers are cleared
diff --git a/libc.in b/libc.in
index 87ff437332889d22c2c1f87723b1ee0e5211fc32..5e392c1c29e9741b0461f8a57cadbef18bdc1bee 100644 (file)
--- a/libc.in
+++ b/libc.in
@@ -146,8 +146,11 @@ fi
 
 # Create our resolv.conf now
 (umask 022; printf "$newconf" >"$resolv_conf")
-
-$RESOLVCONF -s nscd restart
+if [ "$(command -v service)" = service ]; then
+       service nscd restart
+else
+       $RESOLVCONF -s nscd restart
+fi
 
 retval=0
 # Notify users of the resolver
index 04e0e85d26abd6cde3abff3ff77c998f6eba0b0c..1b38a015859e3c426aba4c7d06b3d66a66148923 100644 (file)
--- a/named.in
+++ b/named.in
@@ -74,5 +74,11 @@ then
        changed=true
 fi
 
-$changed && $RESOLVCONF -s named restart
+if $changed; then
+       if [ "$(command -v service)" = service ]; then
+               service named restart
+       else
+               $RESOLVCONF -s named restart
+       fi
+fi
 exit 0
index f73cc7235bd77a201c8b8a8b1e5ac3a3386bddfd..b96808430f60578d685aec7edf4c02511ff85ba8 100755 (executable)
@@ -54,5 +54,9 @@ if [ ! -f "$pdns_zones" ] || \
        [ "$(cat "$pdns_zones")" != "$(printf "$newzones")" ]
 then
        printf "$newzones" >"$pdns_zones"
-       $RESOLVCONF -s pdns_recursor restart
+       if [ "$(command -v service)" = service ]; then
+               service pdns_recursor restart
+       else
+               $RESOLVCONF -s pdns_recursor restart
+       fi
 fi