1 IFACE_GLOBAL=$(uci_get "system.@rdate[0].interface")
10 rdate -s "$server" >/dev/null 2>/dev/null && {
11 logger -t rdate "Synced with $server"
14 logger -t rdate "Failed to sync with $server"
23 config_get server "$section" hostname
24 [ -z "$server" ] && return
27 config_get iface "$section" interface
28 [ -z "$iface" ] && iface=$IFACE_GLOBAL
30 [ "$iface" = "$INTERFACE" ] || return
33 SERVERS="${SERVERS} $server"; : $((MAX++))
39 server=$(uci_get_state "network.$INTERFACE.lease_timesrv")
40 [ -n "$server" ] && do_rdate "$server"
41 [ -n "$SYNCED" ] && return
43 config_load timeserver
44 config_foreach add_server timeserver
47 while [ $MAX -gt 0 ] && [ -z "$SYNCED" ]; do
48 unset servers; random=$(awk "BEGIN { srand(); print int(rand() * $MAX + 1); }")
49 for server in $SERVERS; do
50 [ $((--random)) -eq 0 ] && { do_rdate "$server"; continue; }
51 servers="${servers} $server"
53 SERVERS="${servers}"; : $((MAX--))
56 [ -z "$SYNCED" ] && logger -t rdate "No usable time server for $INTERFACE found"
59 case "${ACTION:-ifup}" in