Obtaining NTP Settings returns error

(imported topic written by JasonO91)

Greetings,

For some reason some unix machines return “” for the following relevance:

if (exists line whose (it contains “server”) of file “/etc/ntp.conf”) then (lines whose (it contains “server”) of file “/etc/ntp.conf”) else if (exist line whose (it contains “server”) of file “/etc/inet/ntp.conf”) then (lines whose (it contains “server”) of file “/etc/inet/ntp.conf”) else “No NTP Server Configured”

From what I can tell, the errors are created when the file exists but does not contain “server”. In AIX, Linux, and HP-UX ntp.conf is in /etc, and in Solaris it’s in /etc/inet/. I’m checking either file for the line server and if I can’t find it then returning “No NTP Server Configured”

Some help would greatly be appreciated.

It’d be real nice if I could run the QnA against another machine to troubleshoot this on my own

Jason

(imported comment written by BenKus)

I re-wrote it a bit to handle the errors:

lines whose (it as lowercase contains “server”) of files ("/etc/inet/ntp.conf";"/etc/ntp.conf") whose (exists line whose (it as lowercase contains “server”) of it)

I don’t have a Linux system to test on, but hopefully that is close…

Ben

(imported comment written by SystemAdmin)

I found myself also using this query, and modified it to clean up the comments

lines whose (it as lowercase contains “server” and it as string does not start with “#”) of files ("/etc/inet/ntp.conf";"/etc/ntp.conf") whose (exists line whose (it as lowercase contains “server” and it as string does not start with “#”) of it)