From 933210b681fd4a3f33a6bfdbdcc60758bc6f6ca9 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Fri, 1 May 2009 13:28:16 +0000 Subject: [PATCH] luci-0.8: add missing ff_rdate --- modules/freifunk/root/usr/sbin/ff_rdate | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 modules/freifunk/root/usr/sbin/ff_rdate diff --git a/modules/freifunk/root/usr/sbin/ff_rdate b/modules/freifunk/root/usr/sbin/ff_rdate new file mode 100755 index 000000000..5a728f673 --- /dev/null +++ b/modules/freifunk/root/usr/sbin/ff_rdate @@ -0,0 +1,21 @@ +#!/bin/sh + +uci_get_one() { + for var in "$@"; do + uci -P /var/state get "$var" 2>/dev/null && break + done +} + +local servers=$(uci_get_one "network.wan.lease_timesrv" \ + "system.time.rdate_servers" "freifunk.time.rdate_servers") + +if [ -n "$servers" ]; then + for server in $servers; do + rdate -s $server >/dev/null 2>/dev/null && \ + logger -t rdate "Synced with $server" && break + + logger -t rdate "Failed to sync with $server" + done +else + logger -t rdate "No usable time server found" +fi -- 2.25.1