Setting time without ntp access

Testing some hardware at a lab I ran into a time sync issue. The servers  didn’t have outbound access to ntp (port 123 tcp or udp) but the servers had full outbound access to the web (port 80 and 443 tcp). Only having access to the servers for a week I didn’t want to waste much time on setting up time.

This is the hack I came up with. I created a script called set_time.sh and added it to roots cron so it would run every 15min. This kept time in sync enough for my testing.

#!/bin/bash

date +%T -s "$(lynx --dump http://www.whattimeisit.com/ |grep Mountain |awk '{print $5}')"

 

I only recommend this as a short term quick hack. The proper way to keep time in sync is to use ntp.

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*