You are not logged in.
Pages: 1
For my NTP needs, I've installed openntpd, removed /etc/cron.hourly/adjtime, and added this line to my crontab,
* * * * * ntpd -s && hwclock -w > /dev/null 2>&1 && rm /var/lib/hwclock/adjtime
It works like a charm; however, I have noticed that the ntpd processes never seem to complete. Here's a snippet from my "ps aux" output,
root 11746 0.0 0.0 18196 468 ? Ss 02:10 0:00 ntpd -s
ntp 11764 0.0 0.0 13984 860 ? S 02:11 0:00 ntpd -s
root 11769 0.0 0.0 18196 344 ? Ss 02:11 0:00 ntpd -s
ntp 11780 0.0 0.0 13984 860 ? S 02:12 0:00 ntpd -s
root 11785 0.0 0.0 18196 340 ? Ss 02:12 0:00 ntpd -s
ntp 11796 0.0 0.0 13984 860 ? S 02:13 0:00 ntpd -s
root 11801 0.0 0.0 18196 344 ? Ss 02:13 0:00 ntpd -s
ntp 11916 0.0 0.0 13984 860 ? S 02:14 0:00 ntpd -s
And if I pipe the ps aux output through grep and wc, I see that there are over a thousand unended ntp-related processes after running the machine for 9 hours,
[root@reformedtube ~]# uptime ; ps aux | grep ntp | wc -l
02:25:19 up 9:01, 1 user, load average: 0.06, 0.02, 0.00
1084
Does anyone have any ideas?
Offline
'ntpd -s' starts a daemon.
EDIT: This is for ntpd in the 'openntpd' package, not the recommended 'ntp' package.
Last edited by rransom (2010-06-20 04:01:12)
Offline
If you really need to run NTP as a cron job, install 'ntp', not 'openntpd', and use 'ntpd -q'. Then add instructions to the [wiki]NTP[/wiki] wiki page (you can copy the instructions you followed, mutandis mutatis, out of the page history; I just zapped that section a few minutes ago because it was clearly bogus).
I don't think you really need to run NTPD as a cron job, though.
Offline
Wow; thanks for all the tips! I'll try just loading it in the daemons array instead of using a cron job.
Offline
Yes, just add it to your rc.conf.
For the record though, the -d option (openntpd) does not daemonise it. Rtfm (in a nice way )
Offline
For the record though, the -d option (openntpd) does not daemonise it. Rtfm (in a nice way )
According to the man page, the -d option does not make openntpd quit after synchronizing the clock once. That is what he would have needed to run it in a cron job.
Offline
Yes you are completely right, I normally run it in a terminal so I forgot about that (I should have read the man page better ).
You would need to do something like:
ntpd -d -s & sleep 5 && pkill -n ntpd
EDIT: or even:
ntpd -d -s & sleep 5 && kill $!
Last edited by quigybo (2010-06-21 11:39:01)
Offline
Pages: 1