[ntp:questions] Regarding updation of IP addresses in the ntpd.conf file
E-Mail Sent to this address will be added to the BlackLists
Null at BlackList.Anitech-Systems.invalid
Thu Jul 19 18:58:19 UTC 2012
Arpith Nayak wrote:
> What I am trying to do is write a program that reads the
> same .conf file used by ntpd and change it based on the
> user's requirements.
Should be as easy as reading, parsing, and writing to any other text file.
> I will be presenting the user with all the addresses
> that are stored in the .conf file
All 4 of them? (Stereotypically speaking) Something like:
<http://www.pool.ntp.org/en/use.html>
driftfile /var/lib/ntp/ntp.drift
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
server 3.pool.ntp.org
More recent versions of ntp, might replace all four of those
lines with one line in the conf file, e.g.:
pool pool.ntp.org
> and want to implement functionality in the program to make
> appropriate changes in the .conf file without resorting
> to ntpq.
ntpq does not change the .conf file,
it changes the running ntpd enviroment.
> So to the user it will be something like this on the CLI:
> set NTP_Server_x xx.xx.xx.xx<IP addresss>
> Is this possible?
Sure, but if they can type that on a command line,
surely they can open a text editor,
and type it in the .conf file?
> How does ntpd read the .conf file and parse the IP
> addresses and drift file location from the file?
Just read the source code, and see for yourself?
You application seems like a pointless exercise,
however only very basic / beginner skills are
required to write a program that opens a text
file, searches for key words, parses the line,
adds, or changes lines, and write the file back out.
You can probably do it in almost any programming
language or scripting language in a few minutes,
and reading and writing text files is likely to
be an example in the tutorials, or sample applications
anyways.
--
E-Mail Sent to this address <BlackList at Anitech-Systems.com>
will be added to the BlackLists.
More information about the questions
mailing list