[OpenWrt-Devel] [PATCH] sysfixtime and ntpd conflict

Mark Andrews mark.andrews at telldus.se
Mon Feb 15 16:29:01 EST 2016


The sysfixtime script can cause ntpd to stop setting managing the time.
This patch ensures that ntpd is restarted after the time is changed by sysfixtime.
---
package/base-files/files/etc/init.d/sysfixtime | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/package/base-files/files/etc/init.d/sysfixtime b/package/base-files/files/etc/init.d/sysfixtime
index ab946f6..87813ea 100755
--- a/package/base-files/files/etc/init.d/sysfixtime
+++ b/package/base-files/files/etc/init.d/sysfixtime
@@ -10,9 +10,12 @@ HWCLOCK=/sbin/hwclock
boot() {
	start && exit 0

-	local curtime="$(date +%s)"
	local maxtime="$(find /etc -type f -exec date -r {} +%s \; | sort -nr | head -n1)"
-	[ $curtime -lt $maxtime ] && date -s @$maxtime
+	local curtime="$(date +%s)"
+	if [ $curtime -lt $maxtime ]; then
+		date -s @$maxtime
+		/etc/init.d/sysntpd restart
+	fi
}

start() {
-- 
2.1.4
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list