summaryrefslogtreecommitdiffstats
path: root/usr/local/sbin/ntpdate_sync_once.sh
blob: e328ac4b4df36dee64f77ebad2c9c03da0c2d7a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

NOTSYNCED="true"
SERVER=`cat /cf/conf/config.xml | grep timeservers | cut -d">" -f2 | cut -d"<" -f1`
pkill -f ntpdate_sync_once.sh

while [ "$NOTSYNCED" = "true" ]; do
	# Ensure that ntpd and ntpdate are not running so that the socket we want will be free.
	killall ntpd 2>/dev/null
	killall ntpdate
	sleep 1
	ntpdate -s -t 5 $SERVER
	if [ "$?" = "0" ]; then
		NOTSYNCED="false"
	fi
	sleep 5
done

/usr/local/sbin/ntpd -s -f /var/etc/ntpd.conf
OpenPOWER on IntegriCloud