diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2009-05-01 13:19:49 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2009-05-01 13:19:49 +0000 |
commit | c2dff916a6186ac227c238d72a1d8d0c65d9fe03 (patch) | |
tree | ef052a98622fdaef7f390948e7c317352ee51b4d /modules/freifunk/root/usr/sbin | |
parent | 67fbe1b33c2195cc763309ba7467100f56676467 (diff) |
modules/freifunk: setup config and cron jobs for rdate; sync time on boot
Diffstat (limited to 'modules/freifunk/root/usr/sbin')
-rwxr-xr-x | modules/freifunk/root/usr/sbin/ff_rdate | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/modules/freifunk/root/usr/sbin/ff_rdate b/modules/freifunk/root/usr/sbin/ff_rdate new file mode 100755 index 0000000000..5a728f6734 --- /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 |