From 65ffcdec62abe7582ea5f9a121cec2ac18293cd9 Mon Sep 17 00:00:00 2001 From: nbd Date: Fri, 5 Sep 2008 18:15:54 +0000 Subject: [PATCH] fix openntpd hotplug script (based on patch from #3027) git-svn-id: svn://svn.openwrt.org/openwrt/packages@12538 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- net/openntpd/files/ntpd.hotplug | 42 ++++++++++------------------------------- 1 file changed, 10 insertions(+), 32 deletions(-) diff --git a/net/openntpd/files/ntpd.hotplug b/net/openntpd/files/ntpd.hotplug index 1b8f1dad7..dfd58d401 100644 --- a/net/openntpd/files/ntpd.hotplug +++ b/net/openntpd/files/ntpd.hotplug @@ -1,34 +1,12 @@ -NAME=ntpd -CONFIG=/etc/$NAME.conf -COMMAND=/usr/sbin/$NAME - -. /etc/functions.sh - -config_cb() { - local cfg="$CONFIG_SECTION" - local cfgtype - config_get cfgtype "$cfg" TYPE - - case "$cfgtype" in - timezone) - config_get posixtz $cfg posixtz - config_get zoneinfo $cfg zoneinfo - - ps x | grep 'ntpd' >&- || { - route -n 2>&- | grep '^0.0.0.0' >&- && { - echo "$posixtz" > /etc/TZ - /etc/init.d/ntpd start - } - } - ;; - esac -} - case "${ACTION:-ifup}" in - ifup) - config_load timezone& - ;; - ifdown) - route -n 2>&- | grep '^0.0.0.0' >&- || /etc/init.d/ntpd stop 2>&- >&- - ;; + ifup) + ps | grep -v 'grep' | grep -v '20-ntpd' | grep -q 'ntpd' || { + route -n 2>/dev/null | grep -q '^0.0.0.0' && { + /etc/init.d/ntpd enabled && /etc/init.d/ntpd start 2>/dev/null >/dev/null + } + } + ;; + ifdown) + route -n 2>/dev/null | grep -q '^0.0.0.0' || /etc/init.d/ntpd stop 2>/dev/null >/dev/null + ;; esac -- 2.11.0