dnsmasq: use ubus signalling in ntp hotplug script
authorKevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk>
Thu, 12 Jan 2017 19:28:53 +0000 (19:28 +0000)
committerHans Dedecker <hans.dedecker@technicolor.com>
Fri, 13 Jan 2017 15:08:22 +0000 (16:08 +0100)
Use ubus process signalling instead of 'kill pidof dnsmasq' for
SIGHUP signalling to dnsmasq when ntp says time is valid.

Signed-off-by: Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk>
package/network/services/dnsmasq/files/dnsmasqsec.hotplug

index 5c69314..a155eb0 100644 (file)
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+. /lib/functions/procd.sh
+
 TIMEVALIDFILE="/var/state/dnsmasqsec"
 
 [ "$ACTION" = stratum ] || exit 0
@@ -7,8 +9,6 @@ TIMEVALIDFILE="/var/state/dnsmasqsec"
 [ -f "$TIMEVALIDFILE" ] || {
        echo "ntpd says time is valid" >$TIMEVALIDFILE
        /etc/init.d/dnsmasq enabled && {
-               pid=$(pidof dnsmasq)
-               [ "$(readlink /proc/$pid/exe)" = "/usr/sbin/dnsmasq" ] && kill -SIGHUP $pid \
-               || /etc/init.d/dnsmasq restart
+               procd_send_signal dnsmasq
        }
 }