summaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2009-05-01 13:19:49 +0000
committerJo-Philipp Wich <jow@openwrt.org>2009-05-01 13:19:49 +0000
commitc2dff916a6186ac227c238d72a1d8d0c65d9fe03 (patch)
treeef052a98622fdaef7f390948e7c317352ee51b4d /modules
parent67fbe1b33c2195cc763309ba7467100f56676467 (diff)
modules/freifunk: setup config and cron jobs for rdate; sync time on boot
Diffstat (limited to 'modules')
-rw-r--r--modules/freifunk/root/etc/config/freifunk9
-rwxr-xr-xmodules/freifunk/root/etc/init.d/freifunk6
-rwxr-xr-xmodules/freifunk/root/usr/sbin/ff_rdate21
3 files changed, 30 insertions, 6 deletions
diff --git a/modules/freifunk/root/etc/config/freifunk b/modules/freifunk/root/etc/config/freifunk
index 516160e82f..ce855e2fe8 100644
--- a/modules/freifunk/root/etc/config/freifunk
+++ b/modules/freifunk/root/etc/config/freifunk
@@ -55,29 +55,28 @@ config defaults wifi_device
option disabled 0
option txpower 10
-
config defaults wifi_iface
option mode adhoc
option bssid 02:CA:FF:EE:BA:BE
option sw_merge 1
-
config defaults interface
option netmask 255.0.0.0
option dns "88.198.178.18 141.54.1.1 212.204.49.83 208.67.220.220 208.67.222.222"
-
config defaults alias
option netmask 255.255.255.0
-
config defaults dhcp
option leasetime 30m
-
config defaults olsr_interface
option Ip4Broadcast 255.255.255.255
+config defaults time
+ option rdate_servers "128.138.140.44 171.64.7.77 171.64.7.99 81.169.154.44 130.133.1.10"
+
+
config community leipzig
option name "Freifunk Leipzig"
option homepage http://leipzig.freifunk.net
diff --git a/modules/freifunk/root/etc/init.d/freifunk b/modules/freifunk/root/etc/init.d/freifunk
index 13dfde7f68..79bcbc7ba9 100755
--- a/modules/freifunk/root/etc/init.d/freifunk
+++ b/modules/freifunk/root/etc/init.d/freifunk
@@ -17,6 +17,10 @@ boot() {
echo "*/5 * * * * /usr/sbin/ff_olsr_watchdog" >> /etc/crontabs/root
}
+ grep -q '/usr/sbin/ff_rdate' /etc/crontabs/root || {
+ echo "0 */4 * * * /usr/sbin/ff_rdate >> /etc/crontabs/root
+ }
+
[ -f /etc/rc.local ] && . /etc/rc.local
[ -d /etc/rc.local.d ] && {
for file in /etc/rc.local.d/*; do
@@ -24,5 +28,5 @@ boot() {
done
}
- /etc/init.d/cron restart
+ ( /usr/sbin/ff_rdate; /etc/init.d/cron restart ) &
}
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