[ntp:questions] NTPD Run

Danny Mayer mayer at ntp.org
Tue Jul 28 12:12:58 UTC 2009

nasa138 wrote:
> I would like to add a few printf statement in the ntpd source code,
> and recompile it, and then run it, so that I can see the value.
> Here's what I did:
> 1) ./configure   --->> it configure ok
> 2) add some printf statements in ntpd.c
> 3) make
> 4) go to ntpd_directory
> 5) run ntpd, by entering ntpd at the prompt
> What I expect to see is some printf statement that I added, but
> nothing happened with command "ntpd". I doubt that I have run ntpd
> correctly. If not, what's the correct way to run ntpd. I tried to run
> with "ntpd -d". But somehow -d is no longer an option. I believe it's
> the option to turn on the debug mode.
> Thanks in advance

There are a number of possibilities:
1) You must run as root as it requires privileges. It needs to bind to a
privileged port (123) and it needs to be able to modify the system clock.
2) If you run with the -Dn or -d option (-D sets the debug level to n
while -d just increments it by one) it will not fork and run in the
forground. The alternative is to use the -n to prevent it forking.
3) You cannot be running another instance of ntpd or it will since it
tries to bind to the NTP port and it should fail.

Have you checked your syslog to see if it complained about anything?


This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

More information about the questions mailing list