# ntpd setup

**URL:** <https://dietpi.com/forum/t/ntpd-setup/188>\
**Category:** Troubleshooting\
**Created:** [28 November 2015 13:40 UTC](https://dietpi.com/forum/t/ntpd-setup/188 "2015-11-28T13:40:44Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Gord\_W](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/g/439d5e/32.png) [@Gord\_W](https://dietpi.com/forum/u/Gord_W)\
**Post date:** [28 November 2015 13:40 UTC](https://dietpi.com/forum/t/ntpd-setup/188/1 "2015-11-28T13:40:44Z")

</div>

Hi,

I would like to get the clock on the rpi set so that it doesn’t drift. I’m using the rpi for a timing application over a wide temperature range and just having the clock updated once per day with a cron job is not going to cut it as the drift is significant.

So I would like to have ntp running all the time.

If I run nptd from the command line, it starts and runs.

I’ve edited the ntp.config file to allow for logs to be created

# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help

driftfile /var/lib/ntp/ntp.drift

# Enable this if you want statistics to be logged.

statsdir /var/log/ntpstats/

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

My rpi is headless and I’m using ssh.

So my problems and questions and remember that I am a beginner here:

1. What is the best way to start ntp at boot and set the clock?
2. Can I just remove the ntp lines in the daily cron job and not break anything else?
3. When i run ntp from the command line the drift file does not get updated. ntp is running under root and the drift file is owned by ntp. I don’t know if that is the problem or not with my ignorance.
4. Is there a place that errors (like file permissions) would show up? I have logging turned on, but there is little that I see in the /var/log area.
5. loopstats and peerstats start to show in the /var/log/ntpstats dir, but they get deleted every few minutes by something so that I only have 0 to 5 last entries. I was expecting a full day per file of data that I could look at.
6. There is no clockstats file - should there be in ntp client mode?

Any other pointers that I may be missing?

Thanks,  
Gordon Williams

---

_[View the full topic](https://dietpi.com/forum/t/ntpd-setup/188)._
