Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
54 lines (51 sloc) 1.29 KB
if [ ! -e /etc/ntp.conf ]; then
if ! grep -q server /etc/ntp.conf; then
SRV_LIST="time.nrc.ca \
timelord.uregina.ca \
ntp.tuxfamily.net \
ntp1.tuxfamily.net \
ntp2.tuxfamily.net \
ntp.univ-lyon1.fr \
zg2.ntp.carnet.hr \
st.ntp.carnet.hr \
ri.ntp.carnet.hr \
os.ntp.carnet.hr \
fartein.ifi.uio.no \
ntp.shim.org \
time.ijs.si \
time.ijs.si \
ntp2a.mcc.ac.uk \
ntp2b.mcc.ac.uk \
time-server.ndo.com \
clock.sjc.he.net \
ntp1.linuxmedialabs.com \
ntp-1.cso.uiuc.edu \
ntp-2.cso.uiuc.edu \
gilbreth.ecn.purdue.edu \
harbor.ecn.purdue.edu \
clock.psu.edu \
ntp-2.ece.cmu.edu \
ntp-1.vt.edu \
ntp1.sth.netnod.se \
ntp2.sth.netnod.se \
ntp1.gbg.netnod.se \
ntp2.gbg.netnod.se \
ntp1.mmo.netnod.se \
ntp2.mmo.netnod.se"
if which ping >/dev/null 2>&1; then
echo -n "Checking for low ping ntp servers:"
for srv in $SRV_LIST; do
roundtrip=`ping -c 2 $srv | grep round-trip | sed -re 's%.*= *[0-9\.]+/([0-9\.]+)/.*%\1%'`
echo "$roundtrip $srv"
done | sort -n -t ' ' -k 1 | head -n 5 | while read roundtrip srv; do
echo -n " $srv($roundtrip ms)"
echo "server $srv" >> /etc/ntp.conf
done
else
echo "Unable to check for lowest ping ntp servers, adding all"
for srv in $SRV_LIST; do
echo "server $srv" >> /etc/ntp.conf
done
fi
fi
fi
Something went wrong with that request. Please try again.