summaryrefslogtreecommitdiffstats
path: root/usr/local/sbin/ntpdate_sync_once.sh
blob: 7aa20a88b9e6dd0a8e65542c9366bf5bc9ba7c79 (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 -g -c /var/etc/ntpd.conf
OpenPOWER on IntegriCloud