I basically want to configure the system so that NTP corrects the time which is otherwise distorted by a strangely unreliable system clock. I have never had a problem like this before but I have on many occasions used ntpd to set the time on a system with no clock battery or whatnot. On this system the clock isn't unreliable on a reboot, while running, it goes fast or slow.
So I decided to make the following script, that will run every five minutes as a cron job.
- Code: Select all
root@ubuntu:~# cat /usr/local/bin/ntp-update
#!/bin/sh
/etc/init.d/ntp stop
/usr/sbin/ntpd -gx -c /etc/ntp.conf
sleep 1
/etc/init.d/ntp start
(I might add it to rc.local as well)
This script unfortunately does not always seem to work. I think there might be an error in my ntpd.conf below:
- Code: Select all
root@ubuntu:~# cat /etc/ntp.conf
driftfile /var/lib/ntp/ntp.drift
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
#These are the addresses for my own NTP servers on my LAN, and the first server on the internet.
server delta.acropolis.local dynamic
server epsilon.acropolis.local dynamic
server lambda.acropolis.local dynamic
server acropolis.johntate.org dynamic
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
restrict 127.0.0.1
restrict ::1

