Sinhronizacija časa

Deluje le če vaša točka lahko vidi 10.14.0.2 in ima nameščen ntpclient. Lahko se uporabi tudi rdate.

Ntpclient lahko namestimo z ukazom:

  ipkg install ntpclient

Da sinhroniziramo čas na naši točki vsako uro je potrebno narediti naslednje:

Nastavimo časovni pas:

vi /etc/TZ

in vpišemo noter:

GMT-1

Ustvarimo datoteko ntpclient:

vi /etc/init.d/ntpclient
chmod +x /etc/init.d/ntpclient

in jo dopolnimo z naslednjo vsebino:

#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
START=90
# kill any existing ntpclient processes
# (they can get stuck if no route to target host)
/usr/bin/killall ntpclient
# do time sync
/usr/sbin/ntpclient -l -h 10.14.0.2 -p 123 -c 1 -s &

#Usage: ntpclient [options]
#options:
# -c count     stop after count time measurements (default 0 means go forever)
# -d           print diagnostics (feature can be disabled at compile time)
# -g goodness  causes ntpclient to stop after getting a result more accurate
#				   than goodness (microseconds, default 0 means go forever)
# -h hostname  (mandatory) NTP server, against which to measure system time
# -i interval  check time every interval seconds (default 600)
# -l           attempt to lock local clock to server using adjtimex(2)
# -p port      local NTP client UDP port (default 0 means "any available")
# -q min_delay minimum packet delay for transaction (default 800 microseconds)
# -r           replay analysis code based on stdin
# -s           simple clock set (implies -c 1)
# -t           trust network and server, no RFC-4330 recommended cross-checks 

omogočimo da se skripta zažene ob zagonu:

/etc/init.d/ntpclient enable

nato uredimo še cron da zaganja skripto vsako uro:

 mkdir /etc/crontabs
 vi /etc/crontabs/root

in vpišemo:

# to timesync every 1 hour
0 * * * * /etc/init.d/ntpclient
wlan-lj/timesync.txt · Last modified: 2009/02/19 01:52 by rokx
 
 
©2008 Another cool website by 80KV