Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RHEL with chrony test time servers

Status
Not open for further replies.

hmcguy

Technical User
Jun 18, 2009
3
US
I am in an environment with RHEL v9+ servers. These are built with chrony installed for time sync. NTP and its associated tools are not installed. I need to be able to test for NTP servers in the environment without making configuration changes to /etc/chrony.conf. I am used to be able to use ntpdate -q <time server> or ntpq -p <time server>. Is there any solution with just chrony? I do not want to install ntp just to be able to use those utilities. I cannot make changes to chrony.conf in production.
 
Well, NTP would be the correct way to do it...
However... if you can fetch the current time (and you're not worried about exact accuracy) you can always set it with a
date --set="08:30:00"

You may be able to do a bash script... something like this?

Bash:
#!/bin/bash
strTime = curl -s "[URL unfurl="true"]http://worldtimeapi.org/api/ip"[/URL] | cut -f16 -d '"' | cut -f2 -d 'T' | cut -f1 -d '.'
date --set=$strTime

(Note: I haven't tested this, since I use NTP... but the curl will return just the time)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top